If Do without Else If Do does not work

Moderator: leecollings

Post Reply
User avatar
AlanGpio
Posts: 15
Joined: Monday 24 February 2020 21:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

If Do without Else If Do does not work

Post by AlanGpio »

Just some heads up that using an If Do with the blue config icon but not setting the Else If Do fails to work.

This situation may arise where a user selected the If Do with Else If Do and then changed their mind and decided the Else condition is no longer needed; or where there was an If Do with and Else If Do and then the Else If Do gets deleted.

Example:
If Do without Else If Do.jpg
If Do without Else If Do.jpg (34.22 KiB) Viewed 481 times

Here is an example with an Else If Do that works
If Do with Else If Do.jpg
If Do with Else If Do.jpg (60.1 KiB) Viewed 481 times

I'm new to Domoticz and the Blockly feature is a quick way to write rules and quick to assimilate when revisiting some months later. But it's a bit frustrating that the If Else does not follow normal programming logic (yes, I've seen the posts) and that If Else's cannot be nested (ditto).

Looking at the Blockly website https://developers.google.com/blockly I see the main stream Blockly has some nice features like loops, mathematical functions, text functions, Lists and sub-functions. Dream on ;)
Hobbyist developing home automation on a Rasp Pi 4 under Buster off SSD.
Custom electronics to link to alarm system, doors, lights, cameras and door bell.
Running Domoticz in a Docker Container along with containers for Moquitto and Portainer.
User avatar
Egregius
Posts: 2589
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: If Do without Else If Do does not work

Post by Egregius »

Why use a else if block if you don't need the else? Then use a if block.
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: If Do without Else If Do does not work

Post by felix63 »

@Egidius The key is in the prase 'and then changed their mind '

Alan, Thanks for sharing your tip!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest