Scripts para cambiar la función AUTO - MANUAL del FreeDS

@EB2RA y @Jhnmcrist del grupo “Domoticz a lo Spain” nos cuentan dos sistemas distintos para utilizar la función AUTO – MANUAL del FreeDS.

Primera opción

@EB2RA ha adaptado el script del tutorial anterior de FreeDS para pasar del modo MANUAL al AUTOMATICO y viceversa con un interruptor:

return {
on = {
devices = {
'FDS-man-auto'
},
},
execute = function(domoticz, device)
if (domoticz.devices('FDS-man-auto').state == 'On') then
domoticz.openURL({
url = 'http://IPDELFREEDS/tooglebuttons?data=7',
method = 'POST',
callback = 'FreeDS'
})
end
if (domoticz.devices('FDS-man-auto').state == 'Off') then
domoticz.openURL({
url = 'http://IPDELFREEDS/tooglebuttons?data=7',
method = 'POST',
callback = 'FreeDS'
})
end
end
}

Si el togglebutton lo usamos con el valor 5 ENCENDEMOS o APAGAMOS la pantalla del ESP32.

Particularidad sugerida por Vicente: sincronizar los estados, pausar DzVents y cambiar el estado hasta que coincida.

Segunda opción

@Jhnmcrist nos cuenta otro sistema para pasar del modo MANUAL al AUTOMATICO.

Para este script se necesita un interruptor dummy «selector» con dos selectores MAN y AUTO. Y también cambiar el idx por el del dummy de cada uno:

return {
on = {
devices = {
8750
}
},
execute = function(domoticz, device)
if (domoticz.devices(8750).state== 'MAN' ) then
os.execute("mosquitto_pub -t freeds/cmnd/pwmman -m 1")
else if (domoticz.devices(8750).state== 'AUTO' ) then
os.execute("mosquitto_pub -t freeds/cmnd/pwmman -m 0")
--domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
end
end
end
}

Para cualquier duda o consulta tienes disponible el grupo de telegram «Domoticz a lo Spain» para entrar, ponerte cómodo y participar cuanto quieras.

Clica aquí para entrar en él

Cualquier duda, sugerencia o comentario será bien recibida en la web!