Problem with variable

It’s not a joke, that’s what goes on every morning …

I have some piston that during the day turn-on / turn-off the heating.
When the heating turn-on I have one piston on “change to on” of the switch that save in two variable:

  1. the time of start ($time24)
  2. the number of switching (@name_variable + 1)

Well, this works fine during all the day but, at the first turn-on of the day, at 05:20, the heating start but the two variable don’t update, neither.

I tried to change the hour, 05:10, 05:18 but nothing has changed, of course …

I’m going crazy …

OK, without seeing the piston I can only take a wild guess.

When the switch changes to on or off, will the changes to on trigger always be evaluated? Not just during the periods when you want something to happen but absolutely every time regardless of any other condition. So not protected by an only when, not used in a nested if, not the second or later condition in an or or and, etc.

If the answer is no then would you expect the switch to be able change to off without changes to on being evaluated? It has to be as without seeing the off it can’t know the value has changed when it sees an on.

Of course it could be something completely different …

OK, but the piston is very simple …

@RiscTimeOn
@RiscNumeroOn

are two global variables.

So I see. Oh well my previous guess is still useful advice to anyone reading it and the important point is that an ‘on’ event is not enough to make ‘changes to on’ true, the previous one has to be an ‘off’ too and the trigger has to have been evaluated.

Have you turned on full logging in the webCoRE piston? It would be interesting to know if the piston isn’t running at all in the morning, or if it runs but doesn’t think there has been a change, or if it seems to run OK.

There doesn’t look to be much to go wrong with it. The main thing that catches people out with global variables is that the pistons read them into a cache at startup, work with the cached copies, then write any changes back on exit. I don’t see that being an issue for you though.

Does vsw stand for virtual switch? Only the Virtual Switch handler sends an on event whenever you call it’s on() command. Is it possible for the heating to turn off without Risc-Accensione vsw also being set to off?

Tonight I’ll turn on full logging to verify how the piston works …

and yes, vsw is for virtual switch and is possible turn-off the heating with the physical switch but nobody use that switch (100%) and beside I’d see the tile on in the action tiles panel …

The problem was one alexa virtual switch that I turn-on (before turn-on the heating) for trigger one amazon echo …
Evidently at 05:20 AM “alexa” is sound asleep because was blocking the update of variables, while during the day there were no problems.

Removed the alexa virtual switch, the variables are updated in the morning too …