Really impressed with Domoticz. The one thing I'm not sure is covered is what happens in a power outage, from what I can see any timers that should have been performed during the downtime/outage would be missed.
I'd really love to see an implementation of the system knowing when it last did something (maybe via logs or a custom variable that gets written out every so often?) and checking the state of items that should have been turned on since an outage, as my concern is a power outage at the wrong time could mean all lights remain off until the next trigger happens to arrive (likely the next day)
In the meantime, I think I can write a bash script to plug the gap but would love to know what anyone else has done, if they've faced a similar issue
Thanks
M.
Power Outage / Catch Up
Moderators: leecollings, remb0
-
- Posts: 43
- Joined: Saturday 06 August 2016 9:53
- Target OS: Windows
- Domoticz version:
- Location: Sweden
- Contact:
Re: Power Outage / Catch Up
Hi,
I know this is an old thread but is this function implemented in Domoticz?
If not, does anyone know how this can be done instead?
I know this is an old thread but is this function implemented in Domoticz?
If not, does anyone know how this can be done instead?
- user4563
- Posts: 110
- Joined: Tuesday 19 October 2021 17:24
- Target OS: Linux
- Domoticz version: 2025.1
- Contact:
Re: Power Outage / Catch Up
What solutions have you all used after a power outage to turn on switches that should be on (or off) in the timer period?
I'm looking to implement this.
I'm looking to implement this.
ODroid H4+ / Ubuntu server 24.04 LTS
Aeotec Z-Stick Gen5+
ZWave-JS-UI / Mosquitto MQTT
Domoticz for Android
Domoticz Scenes add-on in Kodi
Aeotec Z-Stick Gen5+
ZWave-JS-UI / Mosquitto MQTT
Domoticz for Android
Domoticz Scenes add-on in Kodi
-
- Posts: 662
- Joined: Thursday 10 November 2016 9:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Power Outage / Catch Up
There is no easy way I'm aware off just to get current schedule setpoint (if any) of a given switch. In my case, that's not to handle a power failure case as my PI hosting Domoticz have a battery backup able to last several hours, but for my heating control that is mostly managed by schedules but also take into account presence or door/window that remains opened too long: No way to set back heaters setpoints easily to current scheduled one.
That's IMO a missing feature that would be helpful.
- user4563
- Posts: 110
- Joined: Tuesday 19 October 2021 17:24
- Target OS: Linux
- Domoticz version: 2025.1
- Contact:
Re: Power Outage / Catch Up
I don't have time now but maybe I can look into doing this through DzVents. This would cover light timers after a power on from a power outage.
PseudoCode:
Fire script once on power up
Sleep until all nodes have been queried.
if current time is after sunset and before sunrise, turn on lights
if current time is after sunrise but before sunset, turn off lights
PseudoCode:
Fire script once on power up
Sleep until all nodes have been queried.
if current time is after sunset and before sunrise, turn on lights
if current time is after sunrise but before sunset, turn off lights
ODroid H4+ / Ubuntu server 24.04 LTS
Aeotec Z-Stick Gen5+
ZWave-JS-UI / Mosquitto MQTT
Domoticz for Android
Domoticz Scenes add-on in Kodi
Aeotec Z-Stick Gen5+
ZWave-JS-UI / Mosquitto MQTT
Domoticz for Android
Domoticz Scenes add-on in Kodi
- user4563
- Posts: 110
- Joined: Tuesday 19 October 2021 17:24
- Target OS: Linux
- Domoticz version: 2025.1
- Contact:
Re: Power Outage / Catch Up
So after too many outages, here is my solution for my scenario:
5 minutes after my Windows PC boots from a power outage, I have task scheduler run a PowerShell script to start a DzVents Script:
PowerShell:
or cURL:
5 minutes because I need to make sure all of the Z-Wave nodes are queried first. Domoticz is usually complete in 2 minutes for me. *nix users can add a cronjob.
The DzVents script:
It's just simply checks if it's after sundown then make sure the lights are on or if it's after sunrise make sure they are off.
Using the customEvents you save resources as it only fires on a power restore as a normal DzVents script would fire every minute and using checkFirst() you keep your z-wave network traffic down.
My lights simply follow sundown to sunrise so change according to your schedule/needs after a power outage. Custom times can easily be accomplished with something like:
5 minutes after my Windows PC boots from a power outage, I have task scheduler run a PowerShell script to start a DzVents Script:
PowerShell:
Code: Select all
Invoke-WebRequest -Uri "http://127.0.0.1:8080/json.htm?type=command¶m=customevent&event=power_restored"
Code: Select all
curl --url "http://127.0.0.1:8080/json.htm?type=command¶m=customevent&event=power_restored"
The DzVents script:
Code: Select all
return {
on = {
customEvents = {
'power_restored',
}
},
execute = function(domoticz, item)
--execute only from sundown to sunrise (night)
if (domoticz.time.isNightTime == true) then
domoticz.devices('Kitchen deck').switchOn().checkFirst()
domoticz.devices('Porch light').switchOn().checkFirst()
domoticz.devices('Kitchen deck').switchOn().checkFirst()
domoticz.devices('Living deck').switchOn().checkFirst()
domoticz.devices('Garage lights').switchOn().checkFirst()
domoticz.devices('Driveway lights').switchOn().checkFirst()
domoticz.devices('Deck rail lights').switchOn().checkFirst()
else
--execute only from sunrise to sundown (day)
domoticz.devices('Kitchen deck').switchOff().checkFirst()
domoticz.devices('Porch light').switchOff().checkFirst()
domoticz.devices('Kitchen deck').switchOff().checkFirst()
domoticz.devices('Living deck').switchOff().checkFirst()
domoticz.devices('Garage lights').switchOff().checkFirst()
domoticz.devices('Driveway lights').switchOff().checkFirst()
domoticz.devices('Deck rail lights').switchOff().checkFirst()
end
end
}
Using the customEvents you save resources as it only fires on a power restore as a normal DzVents script would fire every minute and using checkFirst() you keep your z-wave network traffic down.
My lights simply follow sundown to sunrise so change according to your schedule/needs after a power outage. Custom times can easily be accomplished with something like:
Code: Select all
if (domoticz.time.matchesRule('between 45 minutes before sunset and 11:59')) then
-- do something
else
--do something else
end
ODroid H4+ / Ubuntu server 24.04 LTS
Aeotec Z-Stick Gen5+
ZWave-JS-UI / Mosquitto MQTT
Domoticz for Android
Domoticz Scenes add-on in Kodi
Aeotec Z-Stick Gen5+
ZWave-JS-UI / Mosquitto MQTT
Domoticz for Android
Domoticz Scenes add-on in Kodi
Who is online
Users browsing this forum: No registered users and 1 guest