Fix command on/off bug

This commit is contained in:
Joachim Stolberg 2023-02-19 19:07:28 +01:00
parent 6d9c9bb51f
commit 354dcf2684

View File

@ -347,10 +347,10 @@ techage.register_node({"techage:heatexchanger2"}, {
elseif topic == "load" then
return techage.power.percent(nvm.capa_max, nvm.capa)
elseif topic == "on" then
start_node(pos, techage.get_nvm(pos))
State:start(pos, nvm)
return true
elseif topic == "off" then
stop_node(pos, techage.get_nvm(pos))
State:stop(pos, nvm)
return true
else
return "unsupported"
@ -359,10 +359,10 @@ techage.register_node({"techage:heatexchanger2"}, {
on_beduino_receive_cmnd = function(pos, src, topic, payload)
local nvm = techage.get_nvm(pos)
if topic == 1 and payload[1] == 1 then
start_node(pos, techage.get_nvm(pos))
State:start(pos, nvm)
return 0
elseif topic == 1 and payload[1] == 0 then
stop_node(pos, techage.get_nvm(pos))
State:stop(pos, nvm)
return 0
else
return 2, ""