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
+55-5Lines changed: 55 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ Install through [HACS](https://hacs.xyz/)
27
27
| autoconfig | object | | Experimental. See [autoconfig](#autoconfig)
28
28
| sections | list | | Required unless using autoconfig. Entities to show divided by sections, see [sections object](#sections-object) for additional options.
29
29
| layout | string | auto | Valid options are: 'horizontal' - flow left to right, 'vertical' - flow top to bottom & 'auto' - determine based on available space (based on the section->`min_witdh` option, which defaults to 150)
30
-
| energy_date_selection | boolean | false | Integrate with the Energy Dashboard. Filters data based on the [energy-date-selection](https://www.home-assistant.io/dashboards/energy/) card. Use this only for accumulated data sensors (energy/water/gas) and with a `type:energy-date-selection` card. You still need to specify all your entities as HA doesn't know exactly how to connect them but you can use the general kWh entities that you have in the energy dashboard. In the future we may use areas to auto configure the chart.
30
+
| energy_date_selection | boolean | false | Integrate with the Energy Dashboard. Filters data based on the [energy-date-selection](https://www.home-assistant.io/dashboards/energy/) card. Use this only for accumulated data sensors (energy/water/gas) and with a `type:energy-date-selection` card. You still need to specify all your entities as HA doesn't know exactly how to connect them but you can use the general kWh entities that you have in the energy dashboard. In the future we may use areas to auto configure the chart. Not compatible with `time_period`
31
31
| title | string | | Optional header title for the card
32
32
| unit_prefix | string | | Metric prefix for the unit of measurment. See <https://en.wikipedia.org/wiki/Unit_prefix> . Supported values are m, k, M, G, T
33
33
| round | number | 0 | Round the value to at most N decimal places. May not apply to near zero values, see issue [#29](https://github.com/MindFreeze/ha-sankey-chart/issues/29)
@@ -50,6 +50,8 @@ Install through [HACS](https://hacs.xyz/)
50
50
| monetary_unit | string | | Currency of the gas or electricity price, e.g. 'USD'
51
51
| sort_by | string | | Sort the entities. Valid options are: 'state'. If your values change often, you may want to use the `throttle` option to limit update frequency
52
52
| sort_dir | string | desc | Sorting direction. Valid options are: 'asc' for smallest first & 'desc' for biggest first
53
+
| time_period_from | string | | Start of custom time period (e.g., "now-1d", "now/d"). Not compatible with `energy_date_selection`. See [Time period](#time-period)
54
+
| time_period_to | string | now | End of custom time period. Not compatible with `energy_date_selection`. See [Time period](#time-period)
53
55
54
56
### Sections object
55
57
@@ -137,10 +139,57 @@ This card supports automatic configuration generation based on the HA energy das
137
139
# any additional autoconfig options (listed below)
138
140
```
139
141
142
+
or like this:
143
+
144
+
```yaml
145
+
- type: custom:sankey-chart
146
+
autoconfig: true
147
+
time_period_from: "now/d" # today
148
+
```
149
+
140
150
| Name | Type | Requirement | Default | Description |
| print_yaml | boolean | **Optional** | false | Prints the auto generated configuration after the card so you can use it as a starting point for customization. It shows up like an error. Don't worry about it.
143
153
154
+
### Time Period
155
+
156
+
The `time_period_from` and `time_period_to` options allow you to specify a custom time period for data retrieval. The format is based on [Grafana's time range format](https://grafana.com/docs/grafana/latest/dashboards/use-dashboards/?pg=blog&plcmt=body-txt#set-dashboard-time-range).
157
+
158
+
Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks), M (months), y (years)
159
+
160
+
Note that while seconds and minutes are supported, there is a delay in the statistics data in HA of up to 1 hour, so showing small periods like the last 30 mins probably won't work.
161
+
162
+
Examples:
163
+
164
+
- `now-5m`: 5 minutes ago
165
+
- `now-1h`: 1 hour ago
166
+
- `now-1d`: 1 day ago
167
+
- `now-1w`: 1 week ago
168
+
- `now-1M`: 1 month ago
169
+
- `now/d`: Start of the current day
170
+
- `now/w`: Start of the current week
171
+
- `now/M`: Start of the current month
172
+
- `now/y`: Start of the current year
173
+
- `now-1d/d`: Start of the previous day
174
+
175
+
If `time_period_to` is not specified, it defaults to `now`.
176
+
177
+
Example configurations:
178
+
179
+
```yaml
180
+
type: custom:sankey-chart
181
+
title: Last 7 days up to the current moment
182
+
time_period_from: "now-7d"
183
+
```
184
+
185
+
```yaml
186
+
type: custom:sankey-chart
187
+
title: Yesterday
188
+
time_period_from: "now-1d/d"
189
+
time_period_to: "now/d"
190
+
```
191
+
192
+
144
193
## Examples
145
194
146
195
### Simple
@@ -240,7 +289,7 @@ You can find more examples and help in the HA forum <https://community.home-assi
240
289
241
290
This card supports partial Energy dashboard integration. You still need to specify the entities and connections for now. See `energy_date_selection` option.
242
291
243
-
Currently this chart just shows historical data based on a energy-date-selection card. It doesn’t know/care if your entities are in the default energy dashboard.
292
+
Currently this chart just shows historical data based on a energy-date-selection card. It doesn't know/care if your entities are in the default energy dashboard.
244
293
245
294
## FAQ
246
295
@@ -250,7 +299,7 @@ Currently this chart just shows historical data based on a energy-date-selection
250
299
251
300
**Q: How do I get total [daily] energy?**
252
301
253
-
**A:** There isn’t a general Consumed Energy sensor in the HA Energy dashboard AFAIK. HA calculates it based on all the in/out kWh values. I can’t tell you exactly how to calculate it because it depends on what values you can monitor. Some people already have a Total Consumption sensor, others have a Current Consumption and create an integration sensor from that, etc.
302
+
**A:** There isn't a general Consumed Energy sensor in the HA Energy dashboard AFAIK. HA calculates it based on all the in/out kWh values. I can't tell you exactly how to calculate it because it depends on what values you can monitor. Some people already have a Total Consumption sensor, others have a Current Consumption and create an integration sensor from that, etc.
254
303
255
304
**Q: Can I group/sum entities in the chart?**
256
305
@@ -273,11 +322,11 @@ Currently this chart just shows historical data based on a energy-date-selection
273
322
1. `npm i`
274
323
2. `npm start`
275
324
3. The compiled `.js` file will be accessible on
276
-
`http://127.0.0.1:5000/ha-sankey-chart.js`.
325
+
`http://127.0.0.1:3000/ha-sankey-chart.js`.
277
326
4. On a running Home Assistant installation add this to your Lovelace `resources:`
278
327
279
328
```yaml
280
-
- url: 'http://127.0.0.1:5000/ha-sankey-chart.js'
329
+
- url: 'http://127.0.0.1:3000/ha-sankey-chart.js'
281
330
type: module
282
331
```
283
332
@@ -287,3 +336,4 @@ Currently this chart just shows historical data based on a energy-date-selection
0 commit comments