Need help with (nested) Blockly

Moderator: leecollings

Post Reply
njlammerts
Posts: 149
Joined: Wednesday 12 August 2020 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Fryslan
Contact:

Need help with (nested) Blockly

Post by njlammerts »

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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Need help with (nested) Blockly

Post by waaren »

njlammerts wrote: Tuesday 30 March 2021 13:09 I don't know/understand how to "read" or implement the if-do-else statements and how to nest them.
Blockly in domoticz does not support nested if-else
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
njlammerts
Posts: 149
Joined: Wednesday 12 August 2020 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Fryslan
Contact:

Re: Need help with (nested) Blockly

Post by njlammerts »

Is there an other way to achieve the discribes functionality with Blockly? Maybe "nested" is not the correct way to describe my situation?
Does the display blockly method can work as I see some other examples where several functions are attached within if-then-else statements
The first set of blocks work ok (verwarming on/of and setting thermostats to 18/22 and 25/5 ). I can see the Nefit thermostat setpoint change and also I hear the Tuya CV thermostats change the valve position. But when controlling the badkamer and slaapkamer zuid setting and setting the Nefit Setpoint and Valves it goes weird :-)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Need help with (nested) Blockly

Post by waaren »

njlammerts wrote: Tuesday 30 March 2021 13:20 Does the display blockly method can work
No.

If you really want this in Blockly you will have to do something like,

if verwarming = Off
set Clock mode = On
elseif verwarming = On and Nefit temp < 18
set Clock mode = Off
set setpoints 22
elseif verwarming = On and Nefit temp >= 18
set Clock mode = Off
set setpoints 18
elseif verwarming = On and ( Slaapkamer zuid < 20 or badkamer temp < 18)
set Clock mode = Off
set Nefit setpoints 20

etc..
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
njlammerts
Posts: 149
Joined: Wednesday 12 August 2020 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Fryslan
Contact:

Re: Need help with (nested) Blockly

Post by njlammerts »

Changed my Blockly script, and now it work. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest