Logic and Lights

Hi all,

I have a problem. I am setting my lights sensor this way as it seems that my switchbot doesn’t detect luminance as a number but rather the only cards available is “becomes dim/bright”. But when I set this logic up, despite the changed status of brightness on my switchbot sensor, the flow does not run. Hoping someone can help and tell me what is wrong.

The flow should be:
#1. When front door brightness changed to dim, and variable entrance is dim is 1, set it to 0.
#2. When front door brightness changed to bright, and variable entrance is dim is 0, set it to 1.
#3. When someone enters front door, and entrance is dim is 0, turn lights on.

But the lights never turn on. In my testing, unless I manually run no. #1 or #2, the logic does not change the variable number, and therefore when someone enters it always runs based off what the last variable was manually set to in the advanced flow setup.

First of all add log cards (Simple Log) or timeline cards to each and every flowcard.
This way, when running the flow you create historic overviews about what does and what does not happen.
I don’t understand the why of your flow by the way :wink:

Are you sure that “Dim” and “Bright” are numeric variables? It could theoretically also be a boolean (yes/no) variable.
You can check the type and the state of variables in Developer Tools → Devices.
Search for the device and than have a look at the section Capabilities:


I agree with @Peter_Kawa. I don’t understand the flow either.

1 Like

Is there by any chance an issue with Advanced Flows and Logic reading and/or evaluating values from number variables?

This seems like such basic behaviour that I can’t possibly be the first to try it, but I can’t yet see what I might be doing wrong.

I am currently on Homey Pro 2023, software version: 10.1.2-rc.1. I can’t remember if I was seeing this issue before enabling Homey experimental updates (in order to fix the initial issues with connecting to Philips Hue bridge with a large number of devices), but I was seeing this issue a week or so ago on version 10.1.0-rc.4, so it has lasted at least longer than 1 experimental SW update.

I have an advanced flow to control my outside (Hue) lights, including to turn them on 60 minutes before sunset. I was puzzled that it seemed to be turning on rather late, so added a few extra timeline notifications to help diagnose what was going on.

When “Date & Time: the sun sets in <0> minutes”; Then “Timeline: Create a notification: ”
When “Date & Time: the sun sets in <1> minutes”; Then “Timeline: Create a notification: <Sunset in 1 minute>”
When “Date & Time: the sun sets in <number_variable>”; Then “Timeline: Create a notification: <Sunset in <number_variable> minutes>”

Where the Variables panel shows my variable in the Numbers section with a value of 60, e.g.:
(hash symbol) number_variable: 60

The result of the above from yesterday was:
16:07: “Sunset in 1 minute”
16:08: “Sunset in 60 minutes”
16:08: “Sunset”

So, the calculation using an immediate value of <1> (1 minute before sunset) worked fine when compared to the immediate value of <0> (0 minutes before sunset), giving timeline notifications 1 minute apart, as expected.

But, the calculation using an indirect value of <variable_name> (from a number variable) did not work as expected, giving timeline notification at the same time as sunset, suggesting the value from variable was read or evaluated as 0. However the timeline message had managed to read the variable correctly, and displayed the value as 60.

I can also see suspicious behaviour more immediately, if I try adding a new advanced flow card, and see that it is showing number values from device parameters, but not from variables.
For example:
And “Logic < tag number > is less than < number >”

As I select a source for the first < tag number >, in the pop-up selection list, I see values listed against all the device parameters, but only “-” (no number value) alongside all the variables under the “Logic” group. I will try to attach a screenshot of that, and also from the variables tab.

Screenshot from selection list in "Logic < tag number > is less than < number > ":
(showing values against the device parameters, but only a “-” against my Logic number variables)

Screenshot from variables tab, showing values as expected against all my number variables:

I’m still seeing the problem behaviour above, now with Homey Pro (2013) software 10.1.4-rc.2.

From the silence, I guess no one else is seeing any such issue?
Any suggestions for what I could do to improve or further diagnose what is going on?

In short, the following advanced flow WHEN card incorrectly evaluates the variable number as zero, but then the THEN card correctly displays it as a (non-zero) number:

When “Date & Time: the sun sets in <number_variable>”; Then “Timeline: Create a notification: <Sunset in <number_variable> minutes>”

As per the screenshots above, the flow card parameter drop-down list shows “-” (no number value) for all number variables, but correctly shows values for all device number parameters. This seems suspicious to me, or at least it could behave better.

That the self created number logic variable doesn’t show their values if you want to choose one via the tag “menu” :label:, it’s more or less known and not a new behavior since the last firmware updates:

(Firmware v10.1.4-rc.2)

It could even be that this has been the case since the introduction of Advanced Flows, but I don’t know for sure.

I don’t know if and why custom logic variables don’t work with the flow cards sunrise and sunset (perhaps also with other flow cards). I haven’t tried it yet either.

Because these problems can only be solved by Athom, or Athom can only give an explanation for this behavior, my recommendation is to contact Athom support.

Thanks @DirkG for your response. I’ll take that as a positive that I don’t appear to be doing something silly. I have sent a message to Athom Support.

Athom Support have reproduced the calculation issue with sunset flow card and reported it on to the development team (they also said it is known and normal that the custom variables do not show their value in field selection drop-down list).