Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oprava jednotek a grafu #18

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,39 @@ type: custom:apexcharts-card
graph_span: 2d
span:
start: day
stacked: true
apex_config:
legend:
show: false
all_series_config:
type: column
group_by:
func: avg
duration: 1hour
now:
show: true
label: Nyní
stacked: true
header:
show: true
show_states: true
series:
- entity: binary_sensor.hdo
float_precision: 2
unit: kč/kWh
show:
in_header: raw
data_generator: >
return Object.entries(entity.attributes.HDO_HOURLY).map(([date,
value], index) => {
return Object.entries(entity.attributes.HDO_HOURLY).map(([date, value],
index) => {
return [new Date(date).getTime(), value];
});
- entity: sensor.current_spot_electricity_price
float_precision: 2
show:
in_header: raw
data_generator: |
return Object.entries(entity.attributes).map(([date, value], index) => {
return [new Date(date).getTime(), (value + 0.35 + 0.028 + 0.114 )* 1.21];
});
```

Since spot prices are (at the moment) hourly and HDO can be in 15 minute increments, for the graph to work well, both entities must have the same interval duration. Function `group_by` takes care of it. In this example it groups by 1 hour, because that works for me well. In your case, maybe `30minutes` or even `15minutes` might be equired.

### Step 3: Restart HA

For the newly added integration to be loaded, HA needs to be restarted.
Expand Down
6 changes: 5 additions & 1 deletion custom_components/egddistribuce/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ def available(self):

@property
def device_class(self):
return ''
return 'monetary'

@property
def unit_of_measurement(self):
return 'Kč/kWh'

def get_times(self):
i = 0
Expand Down
Binary file modified docs/graf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading