Need help with (nested) Blockly
Posted: Tuesday 30 March 2021 13:09
I have a house with thermostat in living room. Living room has lots af glas (door/window) on south wich makes it warm when sun is shining (even if outside temp is low). Because of this, upstairs is not heated. Only if i close all downstair radiators and set Nefit room thermostat to >20C, all heat is transferred to upstairs radiators and heating up the bed and bathrooms. Because upstairs is no regulation, the temperature is not controlled.
With automatic thermostats I can control the room temperature, but Nefit CV (Central Heating Unit) will only stop when max water temp is reached and CV shuts down. Last winter I fitted all radiators with Zigbee remote thermostat from tuya. Also I installed Nefit Easy on Domoticz/Pi to read/control CV unit. I made several independent blocky scripts witch I have to enable/disable by hand, but they work!
By default all downstairs (room=kamer) thermostats are full open (25C) and upstairs (bathroom=badkamer, slaapkamer zuid=room south)are full closed (5C)
Script 1:
If Nefit room temp >18C, set all room thermostat = 19C. when Nefit room temp <18, set all thermostat = 22C (this regulate downstair room temp +- 19C)
Script 2:
If badkamer <21, set badkamer thermostat =25C, if badkamer >=21, set badkamer thermostat = 15 (this should regulate badkamer temp +-21C) If south temp <20, set south thermostat =25C, if south temp >=21, set south thermostat = 15 (this should regulate badkamer temp +-20C)
script 3:
If Slaapkamer Zuid <19C, set Nefit Setpoint = 19C, If Slaapkamer Zuid >=19C, set Nefit Setpoint = 18C. This regulates the CV heating unit, overruling the Nefit Room thermostat bij "injecting" Domoticz value.
*Nefit room temp is read by the Nefit Easy Thermostat unit
*Nefit Setpoint is the Domoticz value witch can be set to the Nefit Easy thermostat unit
*South is Slaapkamer zuid
I tried to create 1 blockly script where all scripts are integrated and also implementing 1 virtual button (verwarming=heating) wich by pressing should disable the normal program mode from the thermostat and enable/disable boiler (hot water from CV unit) and execute the above scripts (1,2,3)
But I get some strange behavior, possible because of nested if-do / if-do-else statements, and I don't know/understand how to "read" or implement the if-do-else statements and how to nest them.
https://prnt.sc/10zuqwy
With automatic thermostats I can control the room temperature, but Nefit CV (Central Heating Unit) will only stop when max water temp is reached and CV shuts down. Last winter I fitted all radiators with Zigbee remote thermostat from tuya. Also I installed Nefit Easy on Domoticz/Pi to read/control CV unit. I made several independent blocky scripts witch I have to enable/disable by hand, but they work!
By default all downstairs (room=kamer) thermostats are full open (25C) and upstairs (bathroom=badkamer, slaapkamer zuid=room south)are full closed (5C)
Script 1:
If Nefit room temp >18C, set all room thermostat = 19C. when Nefit room temp <18, set all thermostat = 22C (this regulate downstair room temp +- 19C)
Script 2:
If badkamer <21, set badkamer thermostat =25C, if badkamer >=21, set badkamer thermostat = 15 (this should regulate badkamer temp +-21C) If south temp <20, set south thermostat =25C, if south temp >=21, set south thermostat = 15 (this should regulate badkamer temp +-20C)
script 3:
If Slaapkamer Zuid <19C, set Nefit Setpoint = 19C, If Slaapkamer Zuid >=19C, set Nefit Setpoint = 18C. This regulates the CV heating unit, overruling the Nefit Room thermostat bij "injecting" Domoticz value.
*Nefit room temp is read by the Nefit Easy Thermostat unit
*Nefit Setpoint is the Domoticz value witch can be set to the Nefit Easy thermostat unit
*South is Slaapkamer zuid
I tried to create 1 blockly script where all scripts are integrated and also implementing 1 virtual button (verwarming=heating) wich by pressing should disable the normal program mode from the thermostat and enable/disable boiler (hot water from CV unit) and execute the above scripts (1,2,3)
But I get some strange behavior, possible because of nested if-do / if-do-else statements, and I don't know/understand how to "read" or implement the if-do-else statements and how to nest them.
https://prnt.sc/10zuqwy