Page 1 of 1

Blocky if switch=on ?

Posted: Friday 19 February 2016 15:33
by planetf1
I'm slightly confused about events.

I have a lightwave rfremote with 3 sets of 0/1 buttons
These are setup as on/off switched LWRem1,LWRem2, LWRem3 in domoticz

In events using blocky I can create an event that says if (LWRem1) do xxx but what I want to say is if LWRem1=On then or similar, ie I want to distinguish between the off and on button.

For now I defined scenees to do similar effect, but events may prove more flexible.... especially to consolidate multiple devices, link with weather/time of day.

For reference so far I also have some LWRF sockets defined as switches -- control from the UI is fine, and also have imported light/group/scene definitions from Philips Hue, which all appear as a myriad of switches

Re: Blocky if switch=on ?

Posted: Friday 19 February 2016 17:38
by Evelen
do not quite understand what you mean.
Could you come with an example of what you want to achieve?

Re: Blocky if switch=on ?

Posted: Monday 22 February 2016 12:42
by planetf1
Sure,

I have a raspberry pi using domoticz (beta channel). 2.4692 is the current version
To the pi is connected a RFXtrx433e device running firmware 251
I have a set of 3 lightwaveRF "basic" sockets, and the supplied 3 channel remote
I also have a philips hue hub with a variety of groups/lights/scenes imported

the rfx device is setup in domoticz to support all protocols (as I experiment, aware of some limitations)

Under "switches" I have
LWRem1
LWRem2
LWRem3

These represent the three lines (0/1) of the lightwave remote

If I click the "1" button of the first row, the dashboard will show LWRem1 moving to "On" state. Similarly if I click "0" it will move to the off state


I defined a scene "work" where the activiation device is listed as
LWRem1 On
and the Device is
Group Study 100% (this is a hue light bulb group)

I created another scene "All off" where activation is
LWRem1 Off
and the device is the same

This means I can switch the light on/off.

It's overkill compared to a simple switch, but the idea in future is to bring in more complex configurations using other devices.

However I also looked at the "events" capability which to me seemed more flexible .. and as a programmer, a little more intuitive.

ie if someone presses LWRem0=on I'd like to turn light on, If someone presses LWRem0=off I'd like to turn it off

So in events I went to "control" in blocky and selected a "If-Do" puzzle piece.
Then from devices/switches I picked G-L "LWRem1", and I can slot this into the predicate section of the if-do piece.
But then it just says If (LWRem1) then...

I only want to process the event if the On button is pressed, not the off. I can't see how to do this?

Rather than have the remote "LWRem1"'s too buttons set as an On/Off switch, do I need to set them up independently so that each appears as an independent device?

Re: Blocky if switch=on ?

Posted: Monday 22 February 2016 14:35
by StanHD
Hi, do you mean something like this?

Image

Re: Blocky if switch=on ?

Posted: Monday 22 February 2016 15:16
by planetf1
yes, that's what I was expecting .. and now that you've shared that I see how to do in the UI. I hadn't noticed that equality (or other) check in logic!

I'll try again later...... thanks!

In general though if a switch has off/on position is it best modeled as a single on/off switch or as two buttons? I assume the answer is it-depends ... ! If I use as on/off in general the former probably makes sense, whilst if I want to use it more like a scene control with 6 settings (the remote is 3 on/off) modeling each individually may be more intuitive :-)