GithubHelp home page GithubHelp logo

custom-cards / canvas-gauge-card Goto Github PK

View Code? Open in Web Editor NEW
162.0 7.0 25.0 380 KB

The card makes it possible to use gauges from https://canvas-gauges.com/

JavaScript 3.37% TypeScript 92.38% Dockerfile 4.25%

canvas-gauge-card's Introduction

canvas-gauge-card

Build

This card is basically deprecated and do not expect maintainence.

Development

I recommend use vscode devcontainers. do

npm install
npm run build

Inside container you can build, start HA using vscode tasks.

This card allows you to use the awesome gauges at https://canvas-gauges.com/ in your lovelace GUI. This is still a very early and untested alpha version. Tested only on chrome and safari browsers.

If you want to support the developer, please support the lib devs of the canvas-gauges.

Screens

Here is a some different screens from my own setup. But the possibilites to make your own look and feel are great.

Usage

Download through HACS (recommended) or ...

Download the file canvas-gauge-card.js from the latest release to your home assistant config. Add a module link to the canvas-gauge-card.js file. The link needs to be the same as where you put it. Example:

resources:
  - url: /local/custom_cards/canvas-gauge-card.js
    type: module

Configure the card properties.

Skip nameproperty if you dont want the name with the shadow area to show.

Use the javascript names of properties from the examples at https://canvas-gauges.com/documentation/examples/. Click on an example that you like, check the JS version and copy the properties to the lovelace yaml file. Just remove the ',' after copy from site.

Example 1, simple half gauge

ui-lovelace.yaml:

Notice the differences in card_height and gauge/height to get correct half size for full circle, set both to same.

- type: custom:canvas-gauge-card
  entity: sensor.processor_use
  card_height: 125
  gauge:
    type: "radial-gauge"
    title: Processor (%)
    width: 220
    height: 220
    borderShadowWidth: 0
    borderOuterWidth: 0
    borderMiddleWidth: 0
    borderInnerWidth: 0
    minValue: 0
    maxValue: 100
    startAngle: 30
    ticksAngle: 180
    valueBox: false
    majorTicks:
      ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"]
    minorTicks: 2
    strokeTicks: true
    highlights: [{ "from": 80, "to": 100, "color": "rgba(200, 50, 50, .75)" }]
    borders: false

Example 2, simple half gauge with shadow text

ui-lovelace.yaml:

- type: custom:canvas-gauge-card
  entity: sensor.processor_use
  name: Processor (%)
  card_height: 145
  shadow_height: 15%
  font_size: 1em
  gauge:
    type: "radial-gauge"
    width: 220
    height: 220
    borderShadowWidth: 0
    borderOuterWidth: 0
    borderMiddleWidth: 0
    borderInnerWidth: 0
    minValue: 0
    maxValue: 100
    startAngle: 90
    ticksAngle: 180
    valueBox: false
    majorTicks:
      ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"]
    minorTicks: 2
    strokeTicks: true
    highlights: [{ "from": 80, "to": 100, "color": "rgba(200, 50, 50, .75)" }]
    borders: false

Example 3, simple full gauge with shadow text

ui-lovelace.yaml:

- type: custom:canvas-gauge-card
  entity: sensor.processor_use
  name: Processor (%)
  card_height: 210
  shadow_height: 12%
  font_size: 1em
  gauge:
    type: "radial-gauge"
    width: 220
    height: 220
    borderShadowWidth: 0
    borderOuterWidth: 0
    borderMiddleWidth: 0
    borderInnerWidth: 0
    minValue: 0
    maxValue: 100
    startAngle: 40
    ticksAngle: 280
    valueBox: false
    units: "%"
    majorTicks:
      ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"]
    minorTicks: 2
    strokeTicks: true
    highlights: [{ "from": 80, "to": 100, "color": "rgba(200, 50, 50, .75)" }]
    borders: false

Example 4, 4 gauges in a row in a horizontal-stack

This example shows gauges with or without text. This text are placed below the actual gauge this time.

No text version

---
- type: horizontal-stack
  cards:
    - type: custom:canvas-gauge-card
      entity: sensor.load_1m
      card_height: 62
      background_color: "#FFF"
      gauge:
        type: "radial-gauge"
        borderShadowWidth: 0
        borderOuterWidth: 0
        borderMiddleWidth: 0
        borderInnerWidth: 0
        width: 110
        height: 110
        minValue: 0
        maxValue: 100
        startAngle: 90
        ticksAngle: 180
        valueBox: false
        majorTicks:
          ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"]
        minorTicks: 2
        strokeTicks: true
        highlights:
          [{ "from": 80, "to": 100, "color": "rgba(200, 50, 50, .75)" }]
        colorPlate: "#ddd"
        borders: false
        needleType: "arrow"
        needleWidth: 2
        needleCircleSize: 7
        needleCircleOuter: true
        needleCircleInner: false
        animationDuration: 1500
        animationRule: "linear"

With text version

---
- type: horizontal-stack
  cards:
    - type: custom:canvas-gauge-card
      entity: sensor.processor_use
      card_height: 62
      name: "Processor use"
      shadow_height: "25%"
      font_size: 0.9em
      shadow_bottom: "20"
      gauge:
        type: "radial-gauge"
        width: 110
        height: 110
        borderShadowWidth: 0
        borderOuterWidth: 0
        borderMiddleWidth: 0
        borderInnerWidth: 0
        minValue: 0
        maxValue: 100
        startAngle: 90
        ticksAngle: 180
        valueBox: false
        majorTicks:
          ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"]
        minorTicks: 2
        strokeTicks: true
        highlights:
          [{ "from": 80, "to": 100, "color": "rgba(200, 50, 50, .75)" }]
        colorPlate: "#ddd"
        borders: false
        needleType: "arrow"
        needleWidth: 2
        needleCircleSize: 7
        needleCircleOuter: true
        needleCircleInner: false
        animationDuration: 1500
        animationRule: "linear"

Properties

Some of the properties that could be set. italic is not mandatory.

Property Description
entity your sensor
name shows the name in shadow remove to hide it
type "radial-gauge" or "linear-gauge"
dropshadow true to show dropshadow, false to hide
width width of the gauge
height height of the gauge
background_color sets gauge background color, transparent default if not set
card_height the actual height of the card, set to smaller value than gauge height if using a half guage. Not use if using a full circle gauge.
font_size size of name, leave out it will be dynamic
shadow_height xx% of total height is shadow height
shadow_bottom how far below the gauge in pixels the shadow should apear

For a complete documentation of available properties, please see https://canvas-gauges.com/documentation/user-guide/configuration

Repos

Credits

canvas-gauge-card's People

Contributors

helto4real avatar hwikene avatar iantrich avatar kdw2060 avatar ludeeus avatar misa1515 avatar olen avatar rhadamantys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

canvas-gauge-card's Issues

HA Companion App does not refresh Canvas Gauges

Hi! Is there any instrumnet to force HA to refresh Gauges in mobile app?
Obsolete data remains (sensor figures) on gauges, only after app closing / reopening again the gauge refreshes & pulls the actual sensor data. It doesn't happen in PC browser though.

Feature: Adapt card background color to theme

It would be beautiful if the card background color wouldn't be hardcoded to white but would adapt to the current theme.

I did this by replacing line 70 in canvas-gauge-card.js:

background-color: white !important;

with

background-color: var( --ha-card-background, var(--paper-card-background-color, white) ); !important;

Display problem: passing by 0 at every value change

Running HA 0.110.4 and canvas 0.4... Display problem, when the value changes, the ticker is moving to 0 before displaying the correct value... I can send you a small screen recording if necessary (file type not supported here). The problem seems only linked with Google Chrome (with Firefox, I do not have that behavior).

Sans titre

host css

Hi, more of a feature request than an issue.
I've noticed your card is missing these css properties the standard cards have and thus don't really look like a card:

:host
  box-shadow: var(--paper-material-elevation-1_-_box-shadow);
  display: block;
  border-radius: 2px;
  transition: all 0.30s ease-out;
  background-color: var(--paper-card-background-color, white);

Might it be possible to add these properties?

thanks for having a look.

Unable to set max properly

I'm trying to set my max value, but I'm unable to get beyond 100.

Code:


type: custom:canvas-gauge-card
entity: sensor.air_quality_index
card-height: 125
gauge:
  type: radial-gauge
  title: AQI
  minValue: 0
  maxValue: 300

What I'm seeing:

Screenshots_2022-06-14-07-47-41

Handle dates

From Home Assistant architectural design rules: In order to optimize stability and performance of Home Assistant, time based sensors should use only absolute time values (store the date of the event) and not relative time values (seconds from event), so the value doesn’t change each second.

So, lovelace cards should handle countdown to date in JS or handle templates.

Could you point me where in the code this enhancement should be done?

Animation Not working as expected

Animation of gauge not working as expected. It doesn't animate from the old value to the new, but 0 to the new. According to the description of the canvas-gauges (https://canvas-gauges.com/documentation/user-guide/configuration), it should animate the needle from old to new value.

Here is my (lovelace) config of the card:

card_height: 175
entity: sensor.verbruik_current
gauge:
animation: true
animationDuration: 1500
animationRule: linear
borderInnerWidth: 0
borderMiddleWidth: 0
borderOuterWidth: 0
borderShadowWidth: 0
borders: false
height: 175
highlights:
- color: 'rgba(200, 50, 50, .75)'
from: 4000
to: 5000
majorTicks:
- '0'
- ' '
- '1000'
- ' '
- '2000'
- ' '
- '3000'
- ' '
- '4000'
- ' '
- '5000'
maxValue: 5000
minValue: 0
minorTicks: 5
startAngle: 45
strokeTicks: false
ticksAngle: 270
title: Verbruik (W)
type: radial-gauge
valueBox: true
valueDec: 0
width: 200
type: 'custom:canvas-gauge-card'

Cannot configure maxvalue < 100

Does it support maxvalue smaller than 100? I have configured minvalue: 0, maxvalue: 80, but it shows scale 0-100. And the highlights are offset, extend the 100 value and overflow outside of the gauge.
It also does not seem to react to many parameters. I have added bar-begin-circle: "false" - it still shows it. Same for other parameters too..
image

Custom element doesn't exist: canvas-gauge-card

- type: module
    url: /community_plugin/canvas-gauge-card/canvas-gauge-card.js

{
  "entity": "sensor.luz_quarto_jc",
  "type": "custom:canvas-gauge-card",
  "card_height": 125,
  "gauge": {
    "type": "radial-gauge",
    "title": "Luminosidade",
    "width": 220,
    "height": 220,
    "minValue": 0,
    "maxValue": 100,
    "startAngle": 30,
    "ticksAngle": 180,
    "valueBox": false,
    "majorTicks": [
      "0",
      "10",
      "20",
      "30",
      "40",
      "50",
      "60",
      "70",
      "80",
      "90",
      "100"
    ],
    "minorTicks": 2,
    "strokeTicks": true,
    "highlights": [
      {
        "from": 80,
        "to": 100,
        "color": "rgba(200, 50, 50, .75)"
      }
    ],
    "borders": false
  }
}

Missing entity renders dashboard page empty

Hello and thanks for making this plugin.
I have a fresh install of Home Assistant and I added canvas-gauge-card through HACS.
In lovelace I added the first example "Example 3, simple full gauge with shadow text", changed the indentation and the entity sensors name, and it worked.
But I noticed that if the entity does not exist, the whole dashboard page is not rendered any more. Looks like a blank page, even if there are other card, regardless of their type.

Error resolving module specifier: canvas-gauges

Hello , i followed the instructions to install it and i get this error in logs and in editor it says:

version= Home Assistant 0.103.6 os=Ubuntu 18.04

Custom element doesn't exist: canvas-gauge-card.

http://192.168.1.108:8123/local/custom_cards/canvas-gauge-card/canvas-gauge-card.js:25:18 TypeError: Error resolving module specifier: canvas-gauges

I added the file .js and i can reach it via url .
Do someone know how i can fix it please?

Error: gauge.min.js

From HA 0.106.0b0 on I get
following error message:

"Protocol details (ERROR)
Logger: hacs
First occured: February 22, 2020, 5:40:11 pm (8 occurences)
Last logged: 11:28:29
Tried to serve up '/config/www/community/canvas-gauge-card/gauge.min.js' but it does not exist"

As a result, the map is not displayed correctly.

Cannot disable drop shadow

PR #5 fixed issue #6 by adding a drop shadow to the canvas to match other cards. However in some circumstances (e.g. when the gauge is part of a stack) it would be useful to be able to switch off the drop shadow. Currently, for example, if I create a vertical-stack or a custom:stack-in-card with a canvas gauge and then a history graph below it, the canvas gauge will retain its border.

Resource not foud

Hi, I downloadesr the two .js files and placed them in \config\www\custom_cards folder, then added this to my configuration file:
resources:

  • url: /local/custom_cards/canvas-gauge-card.js
    type: module

and this to my ui-lovelace file:

  - type: custom:canvas-gauge-card
    entity: sensor.processor_use
    name: Processor (%)
    card_height: 145
    shadow_height: 15%
    font_size: 1em
    gauge:
      type: "radial-gauge"
      width: 220
      height: 220
      minValue: 0
      maxValue: 100
      startAngle: 90
      ticksAngle: 180
      valueBox: false
      majorTicks: ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"]
      minorTicks: 2
      strokeTicks: true
      highlights: [{"from": 80, "to": 100,"color": "rgba(200, 50, 50, .75)"}]
      borders: false   

but when I click on check config, I recive this:

Configuration invalid
Component not found: resources

Can you help me?

Cards Propagate Out of Box in Android

Installed and added 3gauge horizontal stack. Looks ok on the pc browser, but in the android mobile and ipad they propagate out of the box and are cut off.

Does not work?

I have put the js files in the www folder and I have inserted the resources code in top of the Raw config editor.
Then I try to paste some of the examples from here into a Manual Card and in the Raw config editor, but I'm only getting error messages.
I'm not using yaml mode.

Doesn't this Custom card work with HASS 0.87?

Or since I assume my knowledge about Custom cards is almost zero, can someone please submit some example code that is actually working?

The readme file here seems not to be updated to the new standard Lovelace configurations.

Thank you in advance!

RadialGauge is not supported

Please , could you advice when I am receiving RadialGauge is not supported ?
Initial configuration
- type: custom:canvas-gauge-card
entity: sensor.X.X.X.
card_height: 125
gauge:
type: "radial-gauge"

Thank you

PR #5 messed up previous styling and card styling attributes aren't documented

Had a beautiful compass going and although it wasn't centered it still looked great. Updated to the latest version via HACS and now I have a white background. Not sure how to change the background of the card back to the previous transparency because there's no documentation on the new card styling attributes. Could use some help. I mean, I appreciate that it's centered now, but the white bg is killing me.

Tried using:

style:
  background-color:

with both a color name and with rgba coloring, neither worked.

      - type: custom:canvas-gauge-card
        entity: sensor.wind_compass
        gauge:
          type: "radial-gauge"
          height: 250
          width: 250
          minValue: 0
          maxValue: 360
          majorTicks: ["N", "NE", "E", "SE", "S", "SW", "W", "NW", "N"]
          minorTicks: 22
          ticksAngle: 360
          valueBox: false
          startAngle: 180
          strokeTicks: false
          highlights: false
          colorPlate: "rgba(0, 0, 0, .1)"
          colorMajorTicks: "#447BC3"
          colorMinorTicks: "#ddd"
          colorNumbers: "#447BC3"
          colorNeedle: "rgba(240, 128, 128, 1)"
          colorNeedleEnd: "rgba(255, 0, 0, .9)"
          valueTextShadow: false
          colorCircleInner: "#000"
          colorNeedleCircleOuter: "#ccc"
          needleCircleSize: 1
          needleCircleOuter: false
          animationRule: "linear"
          needleType: "line"
          needleStart: 75
          needleEnd: 99
          needleWidth: 3
          borders: true
          borderInnerWidth: 0
          borderMiddleWidth: 0
          borderOuterWidth: 5
          colorBorderOuter: "#447BC3"
          colorBorderOuterEnd: "#447BC3"
          colorNeedleShadowDown: "#222"
          borderShadowWidth: 0
          animationDuration: 1500

/local/gauge.min.js:28:0 SyntaxError

I followed your instructions... I put canvas-gauge-card.js and gauge.min.js both in my Hassio (v. 0.83.2) folder \config\www
I edited ui_lovelace.yaml inserting...

resources:
  - url: /local/canvas-gauge-card.js
    type: module

      - type: custom:canvas-gauge-card
        entity: sensor.temperature_158d0002772a84
        name: Temperatura Esterna (%)
        card_height: 145
        shadow_height: 15%
        font_size: 1em
        gauge:
          type: "radial-gauge"
          width: 220
          height: 220
          minValue: -20
          maxValue: 50
          startAngle: 90
          ticksAngle: 180
          valueBox: false
          majorTicks: ["-30", "-20", "-10", "0", "10", "20", "30", "40", "50"]
          minorTicks: 2
          strokeTicks: true
          highlights: [{"from": 80, "to": 100,"color": "rgba(200, 50, 50, .75)"}]
          borders: false

but after reboot it is not displayed...
and my Hassio I have the following error:

2018-12-06 11:24:35 ERROR (MainThread) [frontend.js.latest.201811211] https://xxx.duckdns.org/local/gauge.min.js:28:0 SyntaxError: illegal character
2018-12-06 11:28:39 ERROR (MainThread) [frontend.js.latest.201811211] https://xxx.duckdns.org/local/gauge.min.js:28:1 Uncaught SyntaxError: Invalid or unexpected token

Background color on units in linear-gauge using black theme

Hi!
I've been looking into removing the white background visible on some of the units in the linear-gauge. It doesn't look good when using black theme. I think I have covered most of the coloring options, but the white is stuck.

What am I doing wrong here? Tried in both Chrome and Firefox with empty cache. The green is only for testing 😁

2021-04-12_170459

Is it possible for the text to show the "group by" value, not the raw value?

My rainfall sensor reports every 5 minutes with the rain that's fallen in that 5 minute interval. So I've configured my chart using "group by: Day". Works awesome.

What I would like however is for the text shown to also show the current day's rainfall. At the moment it shows the sensor data, which is the rainfall for the current 5 minutes. I can only get the daily total by hovering over the last bar in the bar chart.

Is this possible to configure, or is it an enhancement request?

Top left quadrant has wrong image

Hi. I just installed your plugin via HACS (thanks for making it!), but after a short while, the rendered gauge displays the wrong image in the top left q.
It displays the image from the bottom right q instead it seems.
I don't know if this is an issue with your plugin, Home Assistant or the canvas gauges themselves, but you might be the right person to ask.

Configuration for radial gauge included here:

- type: 'custom:canvas-gauge-card'
        entity: sensor.phantom_temp
        card_height: 175
        gauge:
          type: radial-gauge
          title: Phantom MQTT temperature sensor (C)
          width: 200
          height: 200
          borderShadowWidth: 0
          borderOuterWidth: 0
          borderMiddleWidth: 0
          borderInnerWidth: 0
          minValue: -200
          maxValue: 200
          startAngle: 45
          ticksAngle: 270
          valueBox: false
          majorTicks:
            - '-200'
            - '-175'
            - '-150'
            - '-125'
            - '-100'
            - '0'
            - '10'
            - '125'
            - '150'
            - '175'
            - '200'
          minorTicks: 2
          strokeTicks: true
          highlights:
            - from: 150
              to: 200
              color: 'rgba(200, 50, 50, .75)'
          borders: false

Screenshot_20200319_104452

Cannot display attribute

I'm trying to move from tempometer-gauge to these gauges. In tempometer I can specify the entity as climate.evohome_cc_01_185426_00.current_temperature, but if I try and use this entity with canvas gauges I simply get a blank card, and I cannot work out the correct syntax to use to make it work.

Can't get title to display ?

Can't get title to display - tried every which way i can think of.
This is my config in UI-Config yaml
image

type: custom:canvas-gauge-card
entity: sensor.pv_power_now_watts
title: Solar power now
gauge:
type: radial-gauge
width: 210
height: 210
borderShadowWidth: 10
borderOuterWidth: 0
borderMiddleWidth: 0
borderInnerWidth: 0
minValue: 0
maxValue: 7000
startAngle: 40
ticksAngle: 280
valueBox: true
units: Watts
majorTicks:
- '0'
- '1000'
- '2000'
- '3000'
- '4000'
- '5000'
- '6000'
- '7000'
minorTicks: 2
strokeTicks: true
highlights:
- from: 0
to: 1500
color: rgba(200, 50, 50, .75)
borders: false

Error on Home Assistant 0.109.3

Hi, after create card with canvas-gauge-card.js happens error:

canvas-error

frontent does not display anything, the main screen is blank.

Support for Right-Facing Half Radial Gauge

Feature Request: I was hoping to create two side-by-side vertical half-gauges, the left facing one with startAngle 0, and the right facing one with startAngle 180.

However, the width parameter only seems to trim from the left so it clipped the gauge part of the startAngle 180 gauge instead of its empty half on the left. I couldn't figure out how to make it trim from the left so the gauges would be close to each other.

BTW, I suppose one could also want to create two horizontal half gauges, one with startAngle 90 and the other with startAngle 270 for which it would need to trim from the top.

Scaling Issues

Hi!

I love the port and the possibility to use canvas gauges, makes my ups stats more appealing. Tho I have some problems regarding the scaling between devices. It looks perfectly fine on my PC. But it overlaps on phones.

This is from my phone
Screenshot_20201118-032710_Home Assistant

This is on PC:
Screenshot_1

Card width does not seem to work | gauge disappears

Hi there,

Love this card so thank you for making it.

I had a gauge for my Weber iGrill configured in panel mode in its own LL tab with very large height and width so my wife could see it across the room. LL would switch to this tab when the bluetooth thermometer comes online. Lately, don't know when, the gauge disappeared and will only display if I reduce the height/width to 220/220 or something similar.

This is what I had working in panel mode. I'm running under HACS with version 0.4 sitting on HA 0.111.3

entity: sensor.igrill_thermometer
font_size: 1em
gauge:
  animatedValue: true
  borders: true
  colorBorderInner: '#111'
  colorBorderInnerEnd: '#333'
  colorBorderMiddle: '#222'
  colorBorderMiddleEnd: '#111'
  colorBorderOuter: '#333'
  colorBorderOuterEnd: '#111'
  colorNumbers: '#ccc'
  colorPlate: ''
  colorTitle: '#f5f5f5'
  colorUnits: '#f5f5f5'
  height: 720
  highlights:
    - color: 'rgba(0, 68, 255, .75)'
      from: 5
      to: 38
    - color: 'rgba(4, 205, 24, .75)'
      from: 38
      to: 41
    - color: 'rgba(239, 93, 13, .75)'
      from: 41
      to: 45
  majorTicks:
    - '5'
    - '10'
    - '15'
    - '20'
    - '25'
    - '30'
    - '35'
    - '40'
    - '45'
  maxValue: 45
  minValue: 5
  minorTicks: 5
  startAngle: 45
  strokeTicks: true
  ticksAngle: 270
  title: Spa Temp
  type: radial-gauge
  units: °C
  valueBox: true
  valueDec: 1
  valueInt: 2
  width: 600
type: 'custom:canvas-gauge-card'

error

downloaded both JS files to /www/JS folder
added url lines in new love-lace dashboards-resources
copied 1st sample code and changed to one of my sensors using manual card, had to remove dash and 2 spaces
I get this at the top of the window and shows code instead a gauge
Cannot assign to read only property 'borderShadowWidth' of object '#'

Title Color

Hi there. Great work you are doing here. Using chrome predominantly and so far all good, accept for the Title color. The user-guide indicates the use of "colorTitle: xxx". I cannot get it to work. My gauge Name/Title remains white. Any pointers would be appreciated. Thank you.

Installation problems

Hi!
I'm pretty new to HA, so i have some problems: i just can't get this plugin to work. I installed it through HACS, i entered yaml mode in "configuration.yaml", I created ui-lovelace.yaml, transfered my current dashboard so that part works. I just can't add this gauge no matter what. I keep getting errors, like "type: module" is unknow type encountered.

What am i missing? Did i forgot to enter anything anywhere? i event tried to add modul in "normal mode" (without 'mode:yaml' in configuration) sincer module IS available, but same errors...

Thanks!

Not working in Home Assistant 0.106.5

From developer logs: /lovelace/home:0:0 Uncaught TypeError: Failed to resolve module specifier "canvas-gauges". Relative references must start with either "/", "./", or "../".
From Lovelace UI: Cannot read property 'setConfig' of undefined.
Downloaded RAW version from GIT.

Feature request - accept templates for value-text

It would be great if we could have the ‘valueText’ property to accept templates
.
valueText: {{ states(sensor.mysensor_something_else_than_the_gauge) }}

My personal usecase would be to have the gauge show my current output of a solar panel and the valuetext would be the total amount of kWh for that day.

TypeError: hass.states[entityId] is undefined in HA 103.0

Error in HA 0.103.0 prevents loading of the gauge cards.

Thread) [frontend.js.latest.201912041] http://internal_IP/community_plugin/canvas-gauge-card/canvas-gauge-card.js:201:9 TypeError: hass.states[entityId] is undefined
2019-12-11 15:32:39 ERROR (MainThread) [frontend.js.latest.201912041] http://internal_IP/community_plugin/canvas-gauge-card/canvas-gauge-card.js:201:9 TypeError: hass.states[entityId] is undefined
2019-12-11 15:44:28 ERROR (MainThread) [frontend.js.latest.201912041] http://external_IP/community_plugin/canvas-gauge-card/canvas-gauge-card.js:201:44 TypeError: undefined is not an object (evaluating 'hass.states[entityId].state')
2019-12-11 15:44:28 ERROR (MainThread) [frontend.js.latest.201912041] http://external_IP/community_plugin/canvas-gauge-card/canvas-gauge-card.js:201:44 TypeError: undefined is not an object (evaluating 'hass.states[entityId].st

Installed through HACS.

Gauges grow on update

Whenever a gauge updates, it grows. See attached image. Problem occurs with both 0.6 and the previous version,

image

HA 2023.9 beta - some log errors

hey, great integration!

Running 2023.9.0b0, and noticed some logs pertaing to this integration, i'll paste here:

Logger: frontend.js.latest.202308300
Source: components/system_log/__init__.py:269
First occurred: 3:06:53 PM (15 occurrences)
Last logged: 3:56:53 PM

Unhandled promise rejection from Chrome WebView 114.0.5735.220 on Android 9 "http://192.168.1.81:8123/hacsfiles/canvas-gauge-card/canvas-gauge-card.js?hacstag=14254583809"
Unhandled promise rejection from Chrome WebView 114.0.5735.220 on Android 9 "http://192.168.1.81:8123/hacsfiles/lovelace-card-mod/card-mod.js?hacstag=190927524322"
Unhandled promise rejection from Chrome 116.0.0.0 on Windows 10 TypeError: Cannot destructure property 'scrollTop' of 'this._scrollerController' as it is null. scrollTop (src/Virtualizer.ts:741:13) _correctScrollError (src/Virtualizer.ts:546:9) _finishDOMUpdate (src/Virtualizer.ts:538:9) _updateDOM (src/Virtualizer.ts:603:11) _handleLayoutMessage (src/Virtualizer.ts:441:43) _hostSink (src/layouts/shared/BaseLayout.ts:478:9) _sendStateChangedMessage (src/layouts/shared/BaseLayout.ts:364:9) _reflow (src/layouts/flow.ts:491:10) _reflow (src/layouts/shared/BaseLayout.ts:257:11) reflowIfNeeded (src/Virtualizer.ts:563:20)
Unhandled promise rejection from Chrome WebView 114.0.5735.220 on Android 9 3
Unhandled promise rejection from Chrome WebView 114.0.5735.220 on Android 9 { "code": "not_found", "message": "Subscription not found." }

thanks

Half and full gauge mix up

If you have several graphs across different views it looks like the first one you look at make the set-up of the full or half gauge across all the session for all the graphs you had. This way if the first one you look is a half all other full graphs you have in other views will appear only half losing half of it and viceversa, if the first one you look is full you will see all other half as if they were full with the lowest part empty.

Hope I had been able to explain it well.

Thanks

changing colors?

Has anyone tried to change colors of the dials/gauges? I cannot seem to get this to work. If someone can provide an example. that would be great.

I have tried the following
background_color: 'rgba(0, 0, 250, 1)'
data-color-plate: "#222"

But I havent been able to get it to change anything. I wanted a black background, or even gray.

Max gauge value from a sensors value

How can I set the maxValue as well as highlights values from sensors in Home Assistant?
Seems I can only hard code these values
Example
width: 285
height: 300
minValue: 0
maxValue: sensor.meater_probe_internal_2

⚠️ Information: Future card configuration changes.

Hi.

A change in how lovelace cards are set up in Home Assistant 0.105 increases performance, but enables cards to accidentally modify their own configuration in the loaded lovelace configuration.

I'm going through the cards in the HACS default repository, and noticed that your card may be susceptible to this. Looking through your code it seems you may modify parts of the config object passed to your card in setConfig.

The result could be that your card does not work well with the GUI editors or that parts of the configuration start showing up multiple times.

At some point in the future, it is likely that the configuration will be frozen before being passed to setConfig. At this point, your card will fail entirely when it tries to modify the configuration object.

There are several ways to fix/protect agains this problem.

The best is to restructure setConfig such that the configuration is never modified.
Other alternatives are to make a copy of the configuration and work on that instead.

setConfig(config) {
  config = { ...config }; // This works for simple configurations not containing arrays or objects
...
import { deepClone } from "deep-clone-simple";
// https://github.com/balloob/deep-clone-simple

setConfig(config) {
  config = deepClone(config); // This is a safe and fast method
...

or

setConfig(config) {
  config = JSON.parse(JSON.stringify(config)); // This uses built-in functions, but may be slower than deepClone
  ...

Please note that I have not tested your card agains Home Assistant 0.105 or later, but just quickly looked through the code. If I'm mistaken in my assessment, I appologize for taking your time.

See thomasloven/hass-config#6 for more info.

Half gauge not working

The template code of displaying a half gauge with processor% still displays a full gauge (see screenshot). I'm using HA 2022.11.
image

Card configuration code is:
type: custom:canvas-gauge-card entity: sensor.processor_use name: Processor (%) card_height: 145 shadow_height: 15% font_size: 1em gauge: type: radial-gauge width: 220 height: 220 borderShadowWidth: 0 borderOuterWidth: 0 borderMiddleWidth: 0 borderInnerWidth: 0 minValue: 0 maxValue: 100 startAngle: 90 ticksAngle: 180 valueBox: false majorTicks: - '0' - '10' - '20' - '30' - '40' - '50' - '60' - '70' - '80' - '90' - '100' minorTicks: 2 strokeTicks: true highlights: - from: 80 to: 100 color: rgba(200, 50, 50, .75) borders: false

Crash of the view containing the canvas_jauge-card

I am using the last version of "canvas-jauge-card", as well as home assistant on HassOS 5.10 (Pi 4 B 64 bits).
I noticed that on my Huawei tablet (MediaPad M5 Pro) running Android 9 (latest update as well), one view containing a "canvas-jauge-card" was crashing the navigator (I tried: chrome, firefox and opera) as well as the home assistant app. The crash was happening after a long time (more than 30 minutes) with the screen "Aw Snap, something went wrong". I removed the card from the view and the crash disappeared. It is maybe a problem in the definition of the card (see below) or incompatibility with Android 9...

Here is the code of the card (the card is loading correctly):

    - type: custom:canvas-gauge-card
      entity: sensor.smappee_display
      card_height: 230
      shadow_height: 15%
      font_size: 0.9em
      background_color: var(--card-background-color)
      gauge:
        animation: false
        borders: true
        borderShadowWidth: 0
        borderOuterWidth: 0
        borderMiddleWidth: 0
        borderInnerWidth: 0
        type: "radial-gauge"
        width: 220
        height: 220
        minValue: -6000
        maxValue: 14000
        startAngle: 120
        ticksAngle: 200
        valueBox: true
        units: "W"
        colorPlate: "lightgrey"
        majorTicks: ["-6000", " ", "-4000", " ", "-2000", " ", "0", " ", "2000", " ", "4000", " ", "6000", " ", "8000", " ", "10000", " ", "12000", " ", "14000"]
        minorTicks: 2
        strokeTicks: true
        highlights: [{"from": -6000, "to": 0,"color": "lime"}, {"from": 0, "to": 12000,"color": "orange"}, {"from": 12000, "to": 14000,"color": "red"}]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.