You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+26-14Lines changed: 26 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ You may find some extra info there in this link
29
29
30
30
Find more advanced examples in [Show & Tell](https://github.com/dbuezas/lovelace-plotly-graph-card/discussions/categories/show-and-tell)
31
31
32
-
## Installation
32
+
## Installation
33
33
34
34
### Via Home Assistant Community Store (Recommended)
35
35
@@ -41,13 +41,13 @@ Find more advanced examples in [Show & Tell](https://github.com/dbuezas/lovelace
41
41
1. Go to [Releases](https://github.com/dbuezas/lovelace-plotly-graph-card/releases)
42
42
2. Download `plotly-graph-card.js` and copy it to your Home Assistant config dir as `<config>/www/plotly-graph-card.js`
43
43
3. Add a resource to your dashboard configuration. There are two ways:
44
-
1.**Using UI**: `Settings` → `Dashboards` → `More Options icon` → `Resources` → `Add Resource` → Set Url as `/local/plotly-graph-card.js` → Set Resource type as `JavaScript Module`.
45
-
*Note: If you do not see the Resources menu, you will need to enable Advanced Mode in your User Profile*
46
-
2.**Using YAML**: Add following code to lovelace section.
47
-
```resources:
48
-
- url: /local/plotly-graph-card.js
49
-
type: module
50
-
```
44
+
1.**Using UI**: `Settings` → `Dashboards` → `More Options icon` → `Resources` → `Add Resource` → Set Url as `/local/plotly-graph-card.js` → Set Resource type as `JavaScript Module`.
45
+
_Note: If you do not see the Resources menu, you will need to enable Advanced Mode in your User Profile_
46
+
2.**Using YAML**: Add following code to lovelace section.
47
+
```resources:
48
+
- url: /local/plotly-graph-card.js
49
+
type: module
50
+
```
51
51
52
52
## Card Config
53
53
@@ -439,15 +439,15 @@ entities:
439
439
alpha: 0.1 # between 0 an 1. The lower the alpha, the smoother the trace.
440
440
441
441
# The filters below receive all datapoints as they come from home assistant. Y values are strings or null (unless previously mapped to numbers or any other type)
442
-
- map_y: y === "heat" ? 1 : 0 # map the y values of each datapoint. Variables `i` (index), `x`, `state`, `statistic` and `meta`and `vars` are also in scope.
442
+
- map_y: y === "heat" ? 1 : 0 # map the y values of each datapoint. Variables `i` (index), `x`, `y`, `state`, `statistic`, `meta`, `vars` and `hass` are in scope.
443
443
- map_x: new Date(+x + 1000) # map the x coordinate (javascript date object) of each datapoint. Same variables as map_y are in scope
444
444
- fn: |- # arbitrary function. Only the keys that are returned are replaced. Returning null or undefined, leaves the data unchanged (useful )
445
445
446
-
({xs, ys, meta, states, statistics}) => {
446
+
({xs, ys, meta, states, statistics, hass}) => {
447
447
# either statistics or states will be available, depending on if "statistics" are fetched or not
448
448
# attributes will be available inside states only if an attribute is picked in the trace
- From a dashboard in edit mode, go to `Manage resources` and add `http://127.0.0.1:8000/plotly-graph-card.js` as url with resource type JavaScript
718
-
- ATTENTION: The development card is `type: custom:plotly-graph-dev`
730
+
- ATTENTION: The development card is `type: custom:plotly-graph`
719
731
- Either use Safari or Enable [chrome://flags/#unsafely-treat-insecure-origin-as-secure](chrome://flags/#unsafely-treat-insecure-origin-as-secure) and add your HA address (e.g http://homeassistant.local:8123): Chrome doesn't allow public network resources from requesting private-network resources - unless the public-network resource is secure (HTTPS) and the private-network resource provides appropriate (yet-undefined) CORS headers. More [here](https://stackoverflow.com/questions/66534759/chrome-cors-error-on-request-to-localhost-dev-server-from-remote-site)
0 commit comments