I bought the Zooz ZEN15 and want to setup an automation on it. This is what I would like to do.
The switch has power monitoring built in. I want it on, all the time. Then, once the wattage running through it goes over 1000W, I want a two hour timer to start. Once the two hours is reached I want the power switch to turn off and then back on again. It will stay on and the next time the wattage read is over 1000W start the timer again. Rinse, repeat. Any suggestions?
The switch seems to go back to last state on power loss. That is exactly what I need it to do. I was worried I would have to also setup a reoccurring automation to turn the switch on if it was ever off. I might have to anyway but I don’t think so as of right now.
- alias: Reset Heater After Two Hours
trigger:
platform: state
entity_id: sensor.zooz_zen15_power_switch_power
to: '1000'
action:
service: homeassistant.turn_off
entity_id: zwave.zooz_zen15_power_switch
What is the best way to turn it back on? Can I just continue the action or should I make another trigger that turns the switch on when it is off?
- alias: Turn Off Heater After Two Hours
trigger:
platform: state
entity_id: sensor.zooz_zen15_power_switch_power
to: '1000'
for:
minutes: 120
action:
service: homeassistant.turn_off
entity_id: zwave.zooz_zen15_power_switch
- alias: Turn Heater Back On
trigger:
platform: state
entity_id: zwave.zooz_zen15_power_switch
to: 'off'
action:
service: homeassistant.turn_on
entity_id: zwave.zooz_zen15_power_switch
The first automation turns the heater off after 2 hours.
The second automation turns the heater on immediately after it has been turned off.
So basically this heater is always on? It only gets powered down for a few milliseconds while being power-cycled?
What’s the purpose of this thing?
EDIT
I’m a bit dubious about the first automation. You want it to exceed 1000 for 2 hours whereupon it gets turned off. I’m wondering if the automation understands it has to hold a steady value of 1000 for 2 hours before it turns off. I don’t have a means of testing this so I can’t prove my theory. I guess you’ll know soon enough!
I see what your saying. Yeah, that could be a problem if it just thinks once it hits 1000W to turn off.
Here is the reason. Wife leaves a space heater on and never turns it off! I put a killawatt on it and on low it uses 1150W and high is 1400W. Besides the energy usage it is a fire hazzard. She never remembers to turn it off. I get up in the morning to find it has been on all night etc. I figure I would give her two hours before ‘resetting’ it. If you cut power and turn it back on it defaults to off. So, if I cycle the plug I can effectively turn it off but if she is still there she can turn it back on.
I haven’t tried the 1000W part yet, I am just trying to get it to turn itself back on if I turn it off. I can’t get that part to work yet. What am I doing wrong here?
- alias: Turn Heater Back On
trigger:
platform: state
entity_id: zwave.zooz_zen15_power_switch
to: 'off'
action:
service: homeassistant.turn_on
entity_id: zwave.zooz_zen15_power_switch
Hold on. I just thought of something. Am I not using the correct entity id for the switch? I will try something and report back.
Ok! That’s what it was. I had the entity id wrong. The on/off thing works. Now time to test the heater timer.
- alias: Turn Heater Back On
trigger:
platform: state
entity_id: switch.zooz_zen15_power_switch_switch
to: 'off'
action:
service: homeassistant.turn_on
entity_id: switch.zooz_zen15_power_switch_switch
The documentation is so frustrating. So, I see in the documentation I should be able to use ‘above’ as part of my trigger but the configuration check says I can’t. I want to trigger this on using over 1000W for more than 120 minutes. From what I can see: https://www.home-assistant.io/docs/automation/trigger/#numeric-state-trigger
I should be able to do this:
- alias: Turn Off Heater After Two Hours
trigger:
platform: state
entity_id: sensor.zooz_zen15_power_switch_power
above: '1000'
for:
minutes: 120
action:
service: homeassistant.turn_off
entity_id: switch.zooz_zen15_power_switch_switch
But when I save that and check it in HA it says: invalid config for [automation]: [above] is an invalid option for [automation]. Check: automation->trigger->0->above. (See /config/configuration.yaml, line 15). Please check the docs at https://home-assistant.io/components/automation/
And the link doesn’t tell me anything useful. Should I be using a condition instead?
Thanks guys. The numeric state is what I needed for what I was trying to do.
It worked fine and then stopped working for a while with no error. I rebooted the Pi and it is working again. I notice that sometimes automatons won’t consistently run after you create them with just a service restart. I wind up doing a full reboot or they stop after awhile.