when switch is off for 1 minute

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
coene369
Posts: 5
Joined: Wednesday 20 December 2017 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: geleen
Contact:

when switch is off for 1 minute

Post by coene369 »

Hi,

I have serval esp3266 (espeasy) running. these sometimes want to go offline. via hardware (ping) I can see in domoticz whether they are offline or online. now i want to write a script if the esp8266 is offline for more than 1 minute a switch will turn off for 1 minute and turn on again.

how do i do this

thanks in advance
User avatar
waltervl
Posts: 5853
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: when switch is off for 1 minute

Post by waltervl »

Use something like

Code: Select all

if  ( domoticz.devices('your esp3266 device').state == 'Off' and domoticz.devices('your esp3266 device').lastUpdate.secondsAgo > 60 ) then
 domoticz.devices('switch').switchOn().forMin(1)
 end
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest