Condition with Sonoff 4CHPRO

Hello,

I bought a Sonoff 4CHPro, it works well for activation on the graphical interface and also in scenes.

But if I use the function to retrieve the last state, and then add an « if » switch = 1
then turn off the switch works.
but, « if » switch = 1
then turn on the switch also works but it shouldn’t.
(see image)



So here’s the problem, no matter the value of the condition, the condition seems to always be true and I don’t know why.
For me, when the switch is on, it should return « 1 » and when it is off it should return « 0 ». but I have the impression that it returns something else, but in the condition you can only put integers.

Here’s what I had done with the Aquara devices and there was no problem.

Can you help me understand the phenomenon?

Hello @Kalvin! Strange, are you sure you are selecting the right switch? What you are doing seems correct.

It’s true that the display of these devices is not very practical at the moment, we were talking about it yesterday:

In the long term, we would like to split these devices into several devices in Gladys

Yes, that would be really cool, because on the model I have, I have 4 relays, and each relay operates a device in a different room and they all have the same name.
Thank you for your response.

Since they all have the same name, it’s quite complicated. To carry out my tests, I always take the first one, but maybe they are reversed. What do you think?
I will retest by disabling all the actuators and see if the condition at 1 is still valid.

I will keep you informed.
Thanks

I think I found it. In the device settings there is Refresh Rate.

I think that even if I use the function to retrieve the last value, it does not retrieve the current value if the refresh has not occurred.

But…
If I set the frequency to 1 or 2 seconds, I get the impression that the communication is overloaded and nothing works.
So I think we should stay at 1 minute or 30 seconds and the « if » condition will work but a maximum of once per minute (30 s).

Here are the results of my last attempts.

Ah indeed, that’s possible. Besides, Ewelink is known for their API not being stable at all… So it can bug out like here!

If you want to be purely local, you can use Tasmota :slight_smile:

Okay, I’ll take a look