Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bessarabov/ec4abf6c63e4150d12cc954a4253552f to your computer and use it in GitHub Desktop.
Save bessarabov/ec4abf6c63e4150d12cc954a4253552f to your computer and use it in GitHub Desktop.
sensor:
- platform: template
sensors:
pzem_kwh:
unit_of_measurement: kWh
value_template: "{{ states('sensor.pzem_004t_v3_energy') | float / 1000 }}"
utility_meter:
daily_energy_pzem:
source: sensor.pzem_kwh
cycle: daily
daily_energy_pzem_tariff:
source: sensor.pzem_kwh
cycle: daily
tariffs:
- day
- night
automation:
- alias: Set day tariff
trigger:
- platform: time
at: "07:00:00"
action:
- service: utility_meter.select_tariff
entity_id: utility_meter.daily_energy_pzem_tariff
data:
tariff: day
- alias: Set night tariff
trigger:
- platform: time
at: "23:00:00"
action:
- service: utility_meter.select_tariff
entity_id: utility_meter.daily_energy_pzem_tariff
data:
tariff: night
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment