Code: Select all
gpio export 4 out
gpio export 14 out
sudo sh -c "echo '1' >> /sys/class/gpio/gpio4/active_low"
sudo sh -c "echo '1' >> /sys/class/gpio/gpio14/active_low"I have also set up a setpoint and a temperature sensor with index 13 (sensor) and 16 (setpoint)
I want to use gpio 4 (index 20) to control the relay and gpio 14 (index 26) to control a LED.
When I test different values for setpoint, gpio 14 will work, but gpio 4 will not, thoug I can manually switch the value.
I have the created the following script:
Code: Select all
return {
on = { timer = { 'every minute' } },
execute = function(domoticz)
local Sensor = domoticz.devices(13) -- Temperature
local SETPOINT = domoticz.devices(16) -- SetPoint
SETPOINT.updateSetPoint(SETPOINT.setPoint) -- This will refresh the setPoint with current value
if (Sensor.temperature <= (SETPOINT.setPoint - 0.2)) then -- turn on heat
domoticz.devices(20).switchOn().checkFirst()
domoticz.devices(26).switchOff().checkFirst()
elseif (Sensor.temperature >= (SETPOINT.setPoint + 0.2)) then -- turn off hea
domoticz.devices(20).switchOff().checkFirst()
domoticz.devices(26).switchOn().checkFirst()
else
-- within hysteresis range
end
end
}
Best regards
Ulf