OR-statements with conditional actions (other than Only continue if)

I have the following scene:
TRIGGER: device state change
ACTION: if weekdays between 6PM and 8PM OR if weekend between 10AM and 8AM
ACTION: do something

But is seems that actions in the same row run as AND. So the do something will only happen on week AND weekenddays between 6PM and 8PM, but never on weekenddays between 10AM and 6PM.

Of course there is a workaround:

  • Triggerscene
    TRIGGER: device state change
    ACTION: start conditional scene 1 AND start conditional scene 2
  • Conditional scene 1
    ACTION: if weekdays between 6PM and 8PM
    ACTION: start actionscene
  • Conditional scene 2
    ACTION: if weekend between 10AM and 8AM
    ACTION: start actionscene
  • Actionscene
    ACTION: do something

But this sequencing of scenes can quickly result in an overload of scenes.
The tag-system will help, but it has to be extremely robust and futureproof.
Also the “Only continue if” action has an OR-statement, but this doesn’t work for:

  • Check user presence
  • Time condition
  • If the house is empty
  • If the house is not empty
  • Condition on calendar events
  • Condition on Ecowatt
  • If the alarm is in mode

That’s why I’m curious if there is another way to use these conditional actions in IF-statements. I just hope so…

It’s not AND, all actions in the same row run in parallel with no link between them (as stated in the description)

For the list of conditions you listed, there is no way of doing OR statement, only way to do it is to have multiple scenes with a “start scene” block !

We could improve this in the future if there is demand for it, but it’s a huge development :smiley:

I already tought that this would be a huge development. I for myself think it would be a good one. Do you know if there is a feature request in the French forum already? If so, would it be a good idea to also create a feature request here?

Yeah, I read that. I think that’s true from the developer-pov. But for the end user I think it is more or less the same.

  • We either sequence conditions: if condition A is true, we check if condition B is true. If so, we run the final action. So the final action will only run if both condition A AND B are true.
  • Or we run conditions A and B in parallel. If one of both conditions returns false, the progress will stop in the current row and the final action will never happen. But if both condition A AND B are true, we run the final action.

Technically we can’t call both scenario’s an AND-statement. But for the end user they just mimic an AND-statement. Or do I see this wrong?
Second question: are there from a technical point of view pro’s or cons concerning running conditions in parallel or sequence (like serverload)?

I solved this for now by creating a virtual device in the mqtt-integration.

  1. I created a integral mqtt-topic with read-write access in the mqtt-integration: “day-night-status”
  2. I created several scenes to fill this topic
    Trigger scene daily at xx:xx: If weekday and between xx:xx and yy:yy day/night-status is 0
    Trigger scene daily at aa:aa: If weekendday and between aa:aa and bb:bb day/night-status is 1
  3. In any other scene I can call this topic via Get device status and do Only continue if status=0 OR status=1 etc. This way I can reuse the same time-conditions in multiple situations and limit the amount of scenes.

At first I tried a textual mqtt-topic, but it seems that Only continue if can only handle numeric values at the moment. So I integrated the numeric values in names of the defining scenes (see point 2).

There is one called “Continue only if DO THIS / otherwise DO THAT” (Scènes : Continuer seulement si ... SINON / SINON SI - Demande de fonctionnalités - Communauté Gladys Assistant)

Do you think it’s the same ? I don’t see any issue in creating another one here, it’ll increase the “demand” :slight_smile:

It’s not wrong :slight_smile:

It’s just up to you ! We use Node.js, a backend tech that’s very good at multi-tasking.

Most home automation actions are “non-blocking” (you send a request to turn on a light, then wait for a response from the light), so having 50 API calls in parallel is just nothing for the server :smiley: It spends 99% of the time waiting, so better do something else while waiting!

Yes indeed! We could handle text if there is demand for it!

Thanks for all your feedbacks!

1 Like

I think it is slightly different.

  • It is either about improving the listed existing conditional actions with an OR.
  • Or about merging them into Only Continue If, which has already OR.
  • Another take could be a select boxes on the action fields that turns them from a parallel action into an OR-action.

The second and third bullet offer the most flexibility. This way it becomes possible to Only continue if day/time is saturday 13.00 OR if the lights are on OR if the user is present (just a random example).

So this is more about AND/OR.

The request you referenced is about IF…ELSE-statements. They can be useful to, but are slightly different imo.

EDIT: I created two feature requests

You’re welcome. When starting out, one always has the most questions.

Thanks for creating them ! :slight_smile:
I know this forum is not very active yet, but it’s a good start to create content and I hope it’ll incentivize more people to do it.

In the future, I’m hoping to make feature requests english first (as we do for Github issues), but in the meantime having both is fine

1 Like