I have a “dumb” space heater in my drum practice shed connected to a zigbee plug that measure power consumption and I use a Moes IR blaster to turn off or on and set the temperature of the heater.
Ideally I would like to codify the various conditions I use to operate it and make sure it’s off into one single “virtual” device.
Example:
Heater is ON if “power consumption is above 2 watts on the zigbee plug”
Heater is OFF if “power consumption is below 1 watts on the zigbee plug OR Zigbee plug is off”
Turn on =
turn the zigbee plug on IF off
turn the heater on if watt below 1
raise the heater level to l2
Turn off =
Turn off the zigbee power plug
the end result would be a simple switch that I can use to turn off and on the heater from either scripts and automations or from a dashboard.
This code might give you some ideas. Not directly what you want to do. However, it triggers an automation action when a temperature differential between two sensors exceeds a set value. Good hunting!
sensors.yaml
- platform: template
sensors:
# stove temperature minus ambient kitchen temperature
stove_kitchen_temp_diff:
friendly_name: "Stove To Kitchen Ambient Delta"
value_template: >-
{% set stove = states('sensor.kitchen_stove_govee_h5074_temperature') | float(0) %}
{% set kitchen = states('sensor.kitchen_atc_mi_temperature') | float(0) %}
{{ (stove - kitchen) | round(2) }}
unit_of_measurement: '°F'
automation.yaml
- alias: Stove temperature
trigger:
- platform: numeric_state
entity_id: sensor.stove_kitchen_temp_diff
above: 10
for:
minutes: 60
action:
- service: notify.pushover
data:
message: Stove temperature delta has been above 10ºF for 60 minutes.
data:
priority: 1
sound: vibrate
- service: tts.cloud_say
entity_id: media_player.living_room
data:
message: Stove temperature delta has been above 10ºF for 60 minutes.
language: en-US
options:
gender: female