Conditional scene

Sorry for such simpleton question/request, I cannot find clear enough info to make this work…

Just want a scene to not run if a sensor (HSM100) is set as armed.

Would someone end my misery and provide the command?

Thanks a million :slight_smile:

Did you check here for ideas?

Yes, but still struggling. What is the variable SS_ID referencing, I don;t see this as a a field anywhere in the sensor.

Do I reference the ‘main’ sensor or the actual motion sensor?

I am I close at:

local SS_SID = "local SS_SID = “urn:schemas-micasaverde-com:device:MotionSensor:1”

local armed = luup.variable_get(urn:schemas-micasaverde-com:device:MotionSensor:1, “Armed”, 20)
if armed == “1” then false"

It won’t save, so something here is bad…

[code]local deviceNo = 22

local isArmed = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “Armed”, deviceNo)
if isArmed == “1” then
return false
end

return true[/code]

Here is the code you want, you only have to update deviceNo to be the device number of your motion sensor.

@mcvflorin: Do you have any plan to include this conditional events feature in the UI on any release in the near future? It would be a great improvement and a “must” for non geeky users

[quote=“mcvflorin, post:4, topic:167919”][code]local deviceNo = 22

local isArmed = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “Armed”, deviceNo)
if isArmed == “1” then
return false
end

return true[/code]

Here is the code you want, you only have to update deviceNo to be the device number of your motion sensor.[/quote]

Thank you so much, I really appreciate your assistance.

If this fits your request its been ‘requested’ for quite some time…however it never hurts to bump a request in case it was forgotten :smiley:

Topic: Please include “AND” as a scene trigger
http://forum.micasaverde.com/index.php?topic=3185.0

[quote=“mcvflorin, post:4, topic:167919”][code]local deviceNo = 22

local isArmed = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “Armed”, deviceNo)
if isArmed == “1” then
return false
end

return true[/code]

Here is the code you want, you only have to update deviceNo to be the device number of your motion sensor.[/quote]

Unfortunately this is not working for me. Even though the sensor (motion sensor not security sensor) is Armed, the scene executes anyway.

I have tried as many versions as I can see to amend, here’s what I am using, note the full device name is slightly different from what you posted, but i have tried both.

My device ID is 20. Where am I going wrong?

[i]local deviceNo = 20

local isArmed = luup.variable_get(“urn:schemas-micasaverde-com:device:MotionSensor:1”, “Armed”,20)
if isArmed == “1” then
return false
end

return true[/i]

Hopefully this will make it clearer…

Correct…

[tt]local deviceNo = 22
local isArmed = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “Armed”, deviceNo)
[/tt]

Incorrect…

[tt]local deviceNo = 20
local isArmed = luup.variable_get(“urn:schemas-micasaverde-com:device:MotionSensor:1”, “Armed”,20)[/tt]

Basically, you get to read variables from Services (with the [tt]:serviceId:[/tt] bit in the string) not Devices (with the “[tt]:device:[/tt]” bit in the string)

Thank you, this now works, and from the tutorage I hope I can adapt from here for other scenarios.

I agree that it would be nice, but it’s not that easy because there must be support for this in the backend.

@mcvflorin

Does MiCasaVerde have any plans at all to integrate logical conditional’s within Vera’s GUI? The end user should not have to take a college course in Computer Science to understand programming in order to be able to operate Vera and in order to use Vera to its full potential. By this I do mean the much coveted And, Or, If Then, If Else, ect. The Lua engine is very capable and Vera has so much potential that is not being presented to the end user up front (through the GUI). MCV should be tapping into and utilizing Vera to it’s full potential then presenting this to the enduser in a simple, clean interface. If MiCasaVerde could just integrate logical conditional’s within Vera’s GUI, MiCasaVerde really could increase their customer base and improve customer satisfaction/retention by leaps and bounds. Perhaps, even kicking down doors over there at Homeseer and holding Crestron hostage. lmao!

Homeseer’s software has been offering this capability since 2004 when HomeSeer v1.7 was released and Homeseer continues to offer this capability in their much nicer and extremely capable HSTouch, HS2, and HSPro product lineup.

By the way, I am really digging “452” Z FW and the .1230 Vera FW. Overall, the response time is lightning quick compared to how it was with 2.78 and .1186 respectively. MCV Keep up the Good Work!!! and I really hope to see the very much needed Logical Conditional’s within Vera’s GUI in the future.

Currently we write like this…

[tt] local deviceNo = 22
local isArmed = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “Armed”, deviceNo)
if isArmed == “1” then
return false
end

return true
[/tt]

But perhaps simplifying this syntax somewhat would make it easier for people (in the short term):

[tt] luup.devices[22].isArmed()
[/tt]
or maybe be able to specify a “label” against a device so we could do something more readable like:

[tt] luup.devices.KitchenSensor.isArmed()
[/tt]
either way, it would “internally” work out the correct ServiceId to use (since there’s rarely overlap in StateVariable names across services, and few services implemented by a particular device)

If there was a problem, then the “full” version could be used for disambiguation:

[tt] luup.devices.KitchenSensor.isArmed(“urn:micasaverde-com:serviceId:SecuritySensor1”)
[/tt]
… with maybe some pre-defined Constants to avoid typo’s, which would then look more like:

[tt] luup.devices.KitchenSensor.isArmed(SecuritySensor1)
[/tt]
either way, the code then becomes simpler as folks can just write things like:

[tt] return luup.devices.KitchenSensor.isArmed()
[/tt]

… one line of code, and somewhat more readable (arguable, of course) than what folks are currently doing.

I’m fairly sure this could be implemented as Metamethods in Lua, by the MCV Team, to make it happen “on the fly” as needed.

Anyhow, floating the ideas as I think part of the problem is the syntax (more programmer friendly, then user-friendly) and part of it is due to the use of numeric “Id’s” (which users don’t get to assign or change)

@guessed

That is a really good idea and it seems feasible that it could be a start in the right direction if MCV went down that path. A beginning to full integration into the GUI itself. Have to start somewhere, right? lol.