-
Notifications
You must be signed in to change notification settings - Fork 2
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
Newbie Question - How to implement in HA #92
Comments
hello, indeed, we do not provide a way to set peak/offpeak rate as it is something external to this component. The way to implement it highly depends on each case, for instance:
You may need specific components to retrieve it directly from the electricity provider. If your rate change at fixed time and is the same every day, you can use the following configuration (still to be created in input_number:
peak_energy_price:
name: Energy price during peak hours (cts/kWh)
min: 0
step: 0.01
max: 30
unit_of_measurement: EUX/kWh
icon: mdi:currency-eur
offpeak_energy_price:
name: Energy price during off-peak hours (cts/kWh)
min: 0
step: 0.01
max: 30
unit_of_measurement: EUX/kWh
icon: mdi:currency-eur
input_datetime:
elec_peak_hours:
name: Start of peak hours
has_date: false
has_time: true
elec_offpeak_hours:
name: Start of off-peak hours
has_date: false
has_time: true
template:
- sensor:
unique_id: real_peak_energy_price
name: Peak energy price (real value €/kWh)
unit_of_measurement: EUR/kWh
state: "{{ states('input_number.peak_energy_price') | float(0) / 100 }}"
- sensor:
unique_id: real_offpeak_energy_price
name: Offpeak energy price (real value €/kWh)
unit_of_measurement: EUR/kWh
state: "{{ states('input_number.offpeak_energy_price') | float(0) / 100 }}"
- sensor:
unique_id: real_energy_price
name: Energy price
unit_of_measurement: EUR/kWh
state: >
{% set time = now().strftime('%H:%M:%S') %}
{% set is_peak = time >= states('input_datetime.elec_peak_hours') and time < states('input_datetime.elec_offpeak_hours') %}
{% if is_peak %}
{{ states('sensor.peak_energy_price_real_value_eur_kwh') }}
{% else %}
{{ states('sensor.offpeak_energy_price_real_value_eur_kwh') }}
{% endif %} What this configuration do is:
Important note: this configuration only works if your peak hours start before your offpeak. For instance, peak start at 5AM and offpeak starts at 9PM. But it won't work if offpeak starts at 1AM and peak at 8AM. Does it help you? |
I really appreciate the work you've done to supply this. Unfortunately, as a real newbie to HA I am finding it all extremely difficult finding how to actually implement features.
So I installed via HACS download went well and it shows in HACS list of Service.
But what do I do now. Adding that service to a dashboard does nothing. I know you say configure in configuration YAML and happy to do this if I knew how to refer to the device I dont get the link between the configuration.yaml and the service.
This seems to be a common problem I encounter as do others. We get instructions how to install but no clues on implementation.
I put your example in configuration.yaml and it messed up all my existing Utility Meters. I presume I should have put it in a configurations.yaml file that does not exist on my system
The other completley baffling thing is in all your code its does not show how the two tariff rates are specified. I see the singe entry for price = 0.20 and thats it. How do you get offpeak and peak rates.
Ive been looking again and there is this sensor called sensor.current_energy_price but there is no code for this to set it up.
The text was updated successfully, but these errors were encountered: