Page 1 of 1

User variable did not change by event

Posted: Wednesday 06 December 2017 22:19
by denman091
He,

i have one virtual switch for my smartphone and one for my wifes smartphone. if one of us is at home (connect with the wifi) the virtual switch turns on.
Now i want a variable that goes to "1" if one of the two virtual switches is on. and when both virtual switches are off (so we are not at home) the variable need to change to "0".

I made a user variable with type: Float and name "Thuis".
i made the following event: Image
image uploader

Why is this not working?

Re: User variable did not change by event

Posted: Friday 08 December 2017 15:27
by kuifje
Does it work on a specific time table, for instance When its 10 am. So no triggers from a phone but a clock.
When that does work you can go on from here.
Good luck.
Kuifje

Re: User variable did not change by event

Posted: Saturday 09 December 2017 0:58
by denman091
kuifje wrote: Friday 08 December 2017 15:27 Does it work on a specific time table, for instance When its 10 am. So no triggers from a phone but a clock.
When that does work you can go on from here.
Good luck.
Kuifje
Now the event begins with IF: time > 00:00 and smartphone 1 or smarphone 2 = ON.

and now i receive the following error in the log:
2017-12-09 00:55:08.151 Error: EventSystem: Lua script error (Blockly), Name: Set Thuis variabel_2 => [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: ')' expected near 'comparevariable

Re: User variable did not change by event

Posted: Saturday 09 December 2017 6:34
by StanHD
I have similar events working with variables. I would use an Integer type Variablefor this.
May be worth a try?

Re: User variable did not change by event

Posted: Monday 11 December 2017 11:47
by denman091
StanHD wrote: Saturday 09 December 2017 6:34 I have similar events working with variables. I would use an Integer type Variablefor this.
May be worth a try?
I changed it to integer and make the event with 1 switch and that works.
This works:
Image

Then i change te event for 2 switches like:
Image
And this works not. What is wrong with this event? it looks like domoticz don't understand the "OR" in de event.
Or domoticz can not handle two switches in one part.

I put one of the switches "ON" but see not happens in the log.

Edit post:-------------------------------------------------------------------------------------------------------------------------------------------------
Ok, i found the problem.
The event has be like this:
Image
This is working.

Re: User variable did not change by event

Posted: Monday 11 December 2017 20:26
by denman091
problem solved.
See edit post

Re: User variable did not change by event

Posted: Saturday 30 December 2017 22:54
by wuschels
It's much more easier to use "external input" in logical blocks.....