do not know why, the gateway has fw IC3-2-ICN-V1.18.
To solve this i created a new dummy thermostat and changed the script.
now the temperature can be changed from every location and all devices get updated.
Code: Select all
-- DzVents script for setting new thermostat temperature and updating setpoint of LAN2RF Incomfort Gateway Intergas
-- V1.2 (april 2022. gateway thermostat override device does not update so using dummy thermostat)
-- original V1.0 script made by TheKraker. Changed by GravityZ
-- improvements:You now have a thermostat which keeps it's setting, script also works when the real thermostat on the wall is used
-- temperature can be changed from 3 locations (physical thermostat on wall, dummy thermostat from domoticz, Intergas app from phone
-- physical thermostat updates>>THERMOSTAATPROGRAMMA which updates>>dummy thermostat. (gateway setpoint override 1 gets zeroed)
-- app updates>>gateway setpoint override 1 which updates>>THERMOSTAATPROGRAMMA which updates>>dummy thermostat. (gateway setpoint override 1 gets zeroed)
-- dummy thermostat updates>>gateway setpoint override 1 through http which updates>>THERMOSTAATPROGRAMMA(which again updates dummy thermostat but only once to avoid loop)
local IPADDRESS = '192.168.1.80' -- IP address of LAN2RF Gateway
local USER = 'admin' -- login credentials LAN2RF Gateway
local PASSWORD = 'password' -- login credentials LAN2RF Gateway the password is on a sticker on the back of the gateway
local THERMOSTAAT = 'Thermostaat' -- Thermostaat domoticz device name in this case a dummy thermostat device, not the real one which is generated in domoticz
local THERMOSTAATPROGRAMMA = 'Thermostaat-Programma' -- Thermostat setpoint device which represents the current thermostat setting(this is a temp device, not the generated thermostat device)
local THERMOSTAATLIMIT = 22 -- physical thermostat limit
return {
on = {
devices = {THERMOSTAAT,THERMOSTAATPROGRAMMA}
},
execute = function(domoticz, device)
-- if there is a thermostat change coming from domoticz then update the gateway
if (device.name == THERMOSTAAT and domoticz.devices(THERMOSTAAT).setPoint ~= domoticz.devices(THERMOSTAATPROGRAMMA).temperature) then
domoticz.log('Thermostaat setpoint was changed, updating LAN2RF Incomfort Gateway', domoticz.LOG_INFO)
-- Calculating setpoint (see Intergas API documentation)
local SetTemperature = (domoticz.devices(THERMOSTAAT).setPoint - 5) * 10
-- if for some reason(bug) the thermostat is set to high then the setting will be limited to THERMOSTAATLIMIT
if SetTemperature > (THERMOSTAATLIMIT*10)-50 then
SetTemperature = (THERMOSTAATLIMIT*10)-50
domoticz.devices(THERMOSTAAT).updateSetPoint(THERMOSTAATLIMIT).silent()
end
domoticz.openURL('http://' .. USER .. ':' .. PASSWORD .. '@' .. IPADDRESS .. '/protect/data.json?heater=0&setpoint=' .. SetTemperature .. '&thermostat=0')
end
-- if there is a thermostat change coming from the physical thermostat/app then sync it with the dummy thermostat in domoticz
if (device.name == THERMOSTAATPROGRAMMA) then
local SetTemperature = domoticz.devices(THERMOSTAATPROGRAMMA).temperature
if SetTemperature > THERMOSTAATLIMIT then
SetTemperature = THERMOSTAATLIMIT
--we update the thermostat with the THERMOSTAATLIMIT which will trigger the script once more but now with the THERMOSTAATLIMIT value
domoticz.devices(THERMOSTAAT).updateSetPoint(SetTemperature)
else
--we update silent otherwise you get a loop and this script gets triggered again and again
domoticz.devices(THERMOSTAAT).updateSetPoint(SetTemperature).silent()
end
end
end
}