This object is in archive! 

http switch as sensor

Klaus G shared this question 7 years ago
Need Answer

Just a short question: If I use a virtual switch from the control secton as a Sensor, I have six options (see picture). If I use the same switch from the actuator section, I only have three options. Could someone please explain those choices for virtual sensors? (In a meter block they both only have the same options: on or off respectivly)


Best regards

Klaus

Replies (3)

photo
1

Klaus,

I don't know really why we have these differences, for this case I think it is the same. This resemble object oriented programing languages. Attribute refers to a property of the object, in this case the Switch can be ON/OFF, but for some reason can be ANY (which refers more to an event). Event should be something that happens with this device, it can be switched ON, OFF or also it has an event active when it changes state (any), these events happen one time, so the event should is like a trigger, whereas the attribute will stay ON until the device change it's attribute. I hope I'm clear, I always use attribute when I need to evaluate the status of the switch.

I could probably test this with some rules to prove my teory, unfortunatelly I'm having sync issues and cannot test right now.

photo
1

I dont have the option of 6 states for a virtual switch, only 3 same as virtual sensor.


In a meter block there are only 2 options, on/off. Not sure whats going on.

But the main reason for using a virtual sensor as opposed to a virtual switch, is you have a url available for a sensor making it easier to use outside of the zipato system.

But as Alberto says, the 3 options, on/off/any, are triggers for a rule. If you want a rule(or program if you rather) to run dependant on a specific switch state, or any time it is changed.

photo
1

Adrian,


I think Klaus means the different status you get when you use the same device from diffent type of devices. For every virtual sensor you get a control device and an actuator device. If you use actuator device on sensor puzzle you only get 3 attributes (ON, OFF, ANY), if you use the control device on sensor puzzle you get 3 attributes and 3 events with the same description (ON,OFF,ANY).

photo
1

Hi Alberto, yes, thats my question. I´m always insecure about which one to use ;-(

photo
photo
1

Hello,

I use "any" (as sensor) to trigger rules, eg. when a switch changes from on to off or vice versa (toggle / edge triggered).

This works fine and you don't need to bother about a switch state.

What I'm also not entirely shure about, is the difference between selecting a switch from my devices from Actuators or Control. In the beginning I've taken switches from Control (and choose attribute) as that sounded more logical to me. However it did not always properly work (could also have been some other general stability issues i faced at that time).

Nowdays I take the switches from Actuators and it works fine.

Maybe it does not matther, but maybe Zipato can enlight us if there is a better choise (Actuators or Control)?


BR Raffael

photo
1

Raffael,


Using ANY attribute on rules is a very good way to start rules, this way your rule executes with any operation of the device, however it depends on the use you have for the virtual switch.


I also hope someone from zipato would clarify this, I think also that the fact you can miss a particular event. I also use switches as actuator device and it is all good.

photo
Leave a Comment
 
Attach a file