Logic Machine Forum
variable value lost sometimes - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: variable value lost sometimes (/showthread.php?tid=5165)



variable value lost sometimes - Osvaldas - 20.12.2023

Hello,
I have encountered an issue where the script section responsible for heat pump cooling sometimes runs unexpectedly, even though the conditions for its execution are not met. By using the log function, I identified that the variable `holas = '3/0/1'` activated this script, despite no conditions being met to proceed with the script. Upon  checking the log, I noticed that the variable `thermostat_Heating_Cooling` was holding the value 1, indicating that it shouldn't proceed with the script execution.
Is it possible for variables to lose their value at times?



The addresses listed have assigned tags that can trigger the script
holas = '3/0/1'
svetainė = '3/0/3'
kambario = '3/0/4'
miegamojo = '3/0/5'
vonia = '3/0/6'
thermostat_Heating_Cooling = '3/6/20'
sildymas_siurb_arba_centrin = '6/1/13'
sil_siurb_heat_seatpoint = '11/1/16'
sil_siurb_cool_seatpoint = '11/1/15'


Code:
trieigio_PID_enabled_disabled = '3/5/20'
sil_siurb_onoff = '11/1/21'
sil_siurb_cool_heat = '11/1/20'
sil_siurb_cool_heat_setpoint = '11/1/3'
sil_siurb_heat_seatpoint = '11/1/16'
sil_siurb_cool_seatpoint = '11/1/15'
dv1_voztuvas = '4/5/13'
dv2_voztuvas = '4/5/14'
srb1_cirkuliacinis = '4/5/11'
srb2_cirkuliacinis = '4/5/12'
sildymas_siurb_arba_centrin = '6/1/13'
esamas_klimato_rezimas = '6/1/7'
thermostat_Heating_Cooling = '3/6/20'
holas = '3/0/1'
svetainė = '3/0/3'
kambario = '3/0/4'
miegamojo = '3/0/5'
vonia = '3/0/6'
adresas = event.dst
--************************Debugging*********************************
local function logEventWithAddress(event, address)
   
log("Event triggered by address " .. address .. ": " .. event)
end


--*********************Valve control - central heating**************************************
if adresas == sildymas_siurb_arba_centrin or adresas == thermostat_Heating_Cooling then
 
if  not grp.getvalue(sildymas_siurb_arba_centrin) 
 
    and grp.getvalue(thermostat_Heating_Cooling) 
    then 
   
 
    grp.checkwrite (sil_siurb_cool_heat, true) 
      os.sleep(1)
    grp.checkwrite (srb1_cirkuliacinis,true) 
   
 
   
    grp.checkwrite (sil_siurb_onoff, false)
    grp.checkwrite (dv1_voztuvas,true)
    grp.checkwrite (dv2_voztuvas,false) 
    grp.checkwrite (trieigio_PID_enabled_disabled, false)
    logEventWithAddress("Valve control - Central heating", adresas)
 
end
end
--*********************Valve control - Heat pump heating**************************************
if adresas == sildymas_siurb_arba_centrin or adresas == thermostat_Heating_Cooling then
 
if grp.getvalue(sildymas_siurb_arba_centrin) 
 
  and grp.getvalue(thermostat_Heating_Cooling) 
  then
   
 
  grp.checkwrite (sil_siurb_cool_heat, true) 
  os.sleep(1)
  grp.checkwrite (srb1_cirkuliacinis,false) 
  grp.checkwrite (sil_siurb_onoff, true) 
 
 
  grp.checkwrite (dv1_voztuvas,false) 
  grp.checkwrite (dv2_voztuvas,true) 
  grp.checkwrite (trieigio_PID_enabled_disabled, true) 
  logEventWithAddress("Valve control - Heat pump HEATING", adresas)
  end
end
--*********************Valve control - Heat pump cooling**************************************

if not grp.getvalue(thermostat_Heating_Cooling)
    then
 
 
  grp.checkwrite (sil_siurb_cool_heat, false) 
  os.sleep(1)
  grp.checkwrite (sil_siurb_onoff, true) 
 
  grp.checkwrite (srb1_cirkuliacinis,false) -- SRB1 OFF
  grp.checkwrite (dv1_voztuvas,false) 
  grp.checkwrite (dv2_voztuvas,true) 
  grp.checkwrite (trieigio_PID_enabled_disabled, true)
  logEventWithAddress("Valve control - Heat pump COOLING", adresas)
  end



RE: variable value lost sometimes - admin - 20.12.2023

Which firmware version do you have?


RE: variable value lost sometimes - Osvaldas - 21.12.2023

(20.12.2023, 16:16)admin Wrote: Which firmware version do you have?
Firmware version is 2022/12/05


RE: variable value lost sometimes - admin - 22.12.2023

Install 2023 firmware.


RE: variable value lost sometimes - Osvaldas - 22.12.2023

(22.12.2023, 08:50)admin Wrote: Install 2023 firmware.
Thank you for your suggestion.
I've never noticed such a thing before. Just out of curiosity, is it a known bug or something?"


RE: variable value lost sometimes - admin - 22.12.2023

It's a rare bug that was fixed in 2023 RC2: https://forum.logicmachine.net/showthread.php?tid=4572&pid=29578#pid29578


RE: variable value lost sometimes - Osvaldas - 22.12.2023

(22.12.2023, 09:01)admin Wrote: It's a rare bug that was fixed in 2023 RC2: https://forum.logicmachine.net/showthread.php?tid=4572&pid=29578#pid29578

Thank you   Smile