Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Created September 15, 2020 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bessarabov/55a45b9fb4df9cac7eefe3e4ba766772 to your computer and use it in GitHub Desktop.
Save bessarabov/55a45b9fb4df9cac7eefe3e4ba766772 to your computer and use it in GitHub Desktop.
sensor:
- platform: template
sensors:
total_energy_heating_cable:
unit_of_measurement: kWh
value_template: "{{ state_attr('sensor.0x842e14fffe139880_power', 'energy') }}"
binary_sensor:
- platform: template
sensors:
heating_cable_is_operating_normally:
value_template: "{{ states('sensor.0x842e14fffe139880_power') | int > 30 and states('sensor.0x842e14fffe139880_power') | int < 100 }}"
utility_meter:
hourly_energy_heating_cable:
source: sensor.total_energy_heating_cable
cycle: hourly
daily_energy_heating_cable:
source: sensor.total_energy_heating_cable
cycle: daily
monthly_energy_heating_cable:
source: sensor.total_energy_heating_cable
cycle: monthly
automation:
- alias: Turn heating cable on
trigger:
- platform: time_pattern
minutes: "/6"
condition:
- condition: state
entity_id: switch.0x842e14fffe139880_switch
state: 'off'
- condition: numeric_state
entity_id: sensor.outside_temperature_min_value
below: 3
action:
- service: switch.turn_on
entity_id: switch.0x842e14fffe139880_switch
- service: notify.bessarabov
data:
message: "heating cable is on"
- alias: Turn heating cable off
trigger:
- platform: time_pattern
minutes: "/6"
condition:
- condition: state
entity_id: switch.0x842e14fffe139880_switch
state: 'on'
- condition: numeric_state
entity_id: sensor.outside_temperature_min_value
above: 4
action:
- service: switch.turn_off
entity_id: switch.0x842e14fffe139880_switch
- service: notify.bessarabov
data:
message: "heating cable is off"
- alias: Check heating cable is working
trigger:
- platform: state
entity_id: binary_sensor.heating_cable_is_operating_normally
- platform: time_pattern
minutes: "25"
condition:
- condition: state
entity_id: switch.0x842e14fffe139880_switch
state: 'on'
- condition: state
entity_id: binary_sensor.heating_cable_is_operating_normally
state: 'off'
action:
service: notify.bessarabov
data:
message: "heating cable is not working normally"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment