So confused

So i am new to Vera, i just got my VeraLite and am trying to set it up and am so lost as to how to do the things i want to.

I apologize if this is the wrong sub-forum to post in.

I have a ton of questions i haven’t been able to find answers to and yes i looked in the wiki?

[ol][li]are triggers AND triggers or are they OR triggers - i think from the behavior i have seen they are or? if this sensor is tripped or if this one is tripped then the action will execute?.[/li]
[li]if i have a scene set up and i have conditions in LUUP as well as in triggers, which one takes priority and which one runs first?[/li]
[li]how do i customize alert messages?[/li]
[li]when i use the schedule “after sunset” when does it stop running? at sunrise or as 2400?[/li]
[li]my door/window sensors were detected as motion sensors - what is the proper way to get them as a door/window sensor? i made some changes and they appear in the UI as a window sensor now but i can’t set triggers on them and i don’t know why (beyond i did something wrong[/li]
[li]where do you get the variables for objects in the LUUP code? is there some beginners guide to Luup that actually explains where you get these pieces of information? the wiki on lump is very lacking especially in regards to this is where this variable came from these are what each part of this code means?. it really teaches NOTHING[/li][/ol]

lastly i tried using the wiki to create a piece of lump code but because i don’t understand how the elements of the code are generated i am not getting it to work properly? i am trying to have it look to see if motion is detected my either of two motion sensors and if so turn on a light?

local SENSORLIVE = 25 – The living room motion sensor device number
local SENSORDINE = 18 – The dining room motion sensor device number
local LIGHT = 4 – The living room lamp sensor device number

function turnonlight()
local tripped1 = luup.variable_get( SES_SID, “Tripped1”, SENSORLIVE) or “0”
local lastTrip1 = luup.variable_get( SES_SID, “LastTrip1”, SENSORLIVE) or os.time()
local tripped2 = luup.variable_get( SES_SID, “Tripped2”, SENSORDINE) or “0”
local lastTrip2 = luup.variable_get( SES_SID, “LastTrip2”, SENSORDINE) or os.time()
if (tripped1 == “1” or tripped2 == “1” ) then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “80”}, 4)
end

end

[glow=red,2,300]my end goal[/glow] with the code is i want it to only turn on after sunset and stop running after sunrise and then i want it to watch the room and determine if there are people init (motion), if so turn on the lights, if not turn off the lights after 5 minutes?.

Welcome to the Mind Expanding world of Vera!

are triggers AND triggers or are they OR triggers - i think from the behavior i have seen they are or? if this sensor is tripped or if this one is tripped then the action will execute if i have a scene set up and i have conditions in LUUP as well as in triggers, which one takes priority and which one runs first?
A scene is started by [b]ANY[/b] trigger (i.e. the OR behavior), schedule, or the user from the UI. In the case of a trigger, there is a place to add lua code. If that code returns false, the trigger is ignored. There is also a placed to add LUUP code at the Scene level. If it returns false then the commands for the scene are ignored. Otherwise they are executed. Many people put code here to actually automate other devices or scenes.

If multiple triggers happen milli seconds apart … the scene will run twice …
Each triggers starts the scene processing … independent of another trigger.

how do i customize alert messages?
You can't ... unless you use the [b]Vera Alerts[/b] plugin.
when i use the schedule "after sunset" when does it stop running? at sunrise or as 2400?
A schedule ONLY starts a scene running. The scene stops running when the LUUP code for the scene returns false or ALL of the scene's commands are sent.
my door/window sensors were detected as motion sensors - what is the proper way to get them as a door/window sensor? i made some changes and they appear in the UI as a window sensor now but i can't set triggers on them and i don't know why (beyond i did something wrong
Did you change the device type ? ... That's a NO NO unless you really no what you are doing. You have to go with the device type that it auto detects with! Sorry if it's not what you want.
where do you get the variables for objects in the LUUP code? is there some beginners guide to Luup that actually explains where you get these pieces of information? the wiki on lump is very lacking especially in regards to this is where this variable came from these are what each part of this code means?. it really teaches NOTHING
Most people search for an example and copy it. The documentation is lacking. The following will get the information you need to access any variable in Vera:

[ol][li]Find the Device in Vera you are interested[/li]
[li]Goto the Advanced Tab[/li]
[li]Note the Device#[/li]
[li]Find the variable you are interested in (Bottom Half of this tab)[/li]
[li]Note the Variable Name (Case Sensitive)[/li]
[li]Hover the mouse over the Variable Name … it will show the SeviceID to access this variable (Case Sensitive do not confuse with DeviceIDs that look similar)[/li][/ol]

The DeviceID, ServiceID, and Variable name are arguments to:

luup.variable_get(ServiceID, VariableName, DeviceNumber)
lastly i tried using the wiki to create a piece of lump code but because i don't understand how the elements of the code are generated i am not getting it to work properly? i am trying to have it look to see if motion is detected my either of two motion sensors and if so turn on a light?
The code you referenced is incomplete no definition for SES_SID ... is there a variable called Tripped1 and Tripped2 on your devices ? ... You have to read up on LUUP code syntax and semantics to understand the code. Search LUA Coding on this forum or google. The wiki has a page to describe MCV extensions to LUA ... these are all the functions that start as: luup.XXXX
my end goal with the code is i want it to only turn on after sunset and stop running after sunrise and then i want it to watch the room and determine if there are people init (motion), if so turn on the lights, if not turn off the lights after 5 minutes?.
I am biased ... but I recommend [b]Program Logic Event Generator[/b] (or PLEG) and the [b]Day Or Night[/b] plugin.

In PLEG:
Trigger:
Motion1 when motion1 device detects motion
Motion2 when motion2 device detects motion
Night when Day or Night Device indicates Night
Conditions:
TurnLightOn = Night and (Motion1 or Motion2)
TurnLightOff = TurnLightOn; Now > 5:00

You need two scenes:
Scene1 - TurnLightOnScene - Trigger when PLEG satisfies TurnLightOn
Scene1 - TurnLightOffScene - Trigger when PLEG satisfies TurnLightOff

Add the appropriate commands to these scenes.

Thanks for the reply, i am still a bit confused on a number of things but lets start here

======

Quote
when i use the schedule “after sunset” when does it stop running? at sunrise or as 2400?

A schedule ONLY starts a scene running. The scene stops running when the LUUP code for the scene returns false or ALL of the scene’s commands are sent.

========

so if i tell a scene to run after sunset when does the scene NOT run assuming sunset is at 1600 i know it will run at 1601 but will it run at 2400? what about at 0100

so if i tell a scene to run after sunset when does the scene NOT run assuming sunset is at 1600 i know it will run at 1601 but will it run at 2400? what about at 0100

At 1600 it does the same thing as if you clicked the Run Scene from the Web Browser.
If your scene turns on 4 lights … the scene will be running for the time it takes the 4 commands to be successfully sent. Then it’s Done.

Do not think of a scene as when it is running … think of it as when it was started.

As I said a scene can be started from a lot of different places. Each is independent of the others.

[ol][li]A Scene Schedule as we are discussing[/li]
[li]A Trigger[/li]
[li]User Interaction on the Web Browser (Run Scene)[/li]
[li]Started from some external source by sending a Run Scene Command to the scene controller[/li][/ol]

There is no connection between any of these. In particular the Schedule does NOT limit the ability
of the triggers.

That can be done by putting code in the LUUP section associated with the trigger.
Or by putting code at the LUUP level for the scene.

As I mentioned PLEG provides a lot more flexibility over the general MCV Scene, Trigger, Schedule options without having to dive into LUUP coding.

GRRRRRRRRR

thats not my question??

ok what if i say it this way?. it you tell it to ONLY TRIGGER after sunset, when does it STOP triggering

ok what if i say it this way?. it you tell it to ONLY TRIGGER after sunset, when does it STOP triggering

And the answer is:

Do not think of a scene as when it is running ... think of it as when it was started.

There is NOT a way to tell a scene to ONLY TRIGGER after sunset.
There IS only a way to tell a scene to START at sunset.

Via LUUP code attached to a trigger, you can have it IGNORE the trigger if it’s during the day … but that has NOTHING to do with the Schedule

but i am thinking that way because the page says:

Example: Do something at 7:00 on Monday and Wednesday, or [glow=red,2,300]1 hour and 30 minutes before sunset on Fridays.[/glow]

is the UI lying to me?

1 hour and 30 minutes before sunset on Fridays

That is a specific moment in time … sunset is computed from your location (lat/long in Setup) and your Timezone. Every day it computes a new sunrise and sunset time. In this example it will trigger at the sunset time value minus 90 minutes.

Those are all examples of setting up a Scene Schedule. But each fires only at 1 specific time each day.

There is an also an Interval Schedule … than can fire at an interval as small as 1 minute.

Hello WhatIsThisThing,

I gather by the reference you are referring to setting up schedule in a scene directly in your Vera.
As per your example, it is generating two distinct time based triggers determined by the input from the schedule.
So when you use “1 hour and 30 minutes before sunset on Fridays.”, it is calculating the time to trigger based on sunset in your location plus x and there is a simple way to see this… Goto Dashboard > Overview > Upcoming Schedules.
This will display the projected time the schedule will generate the trigger. Using your information when does it stop? Immediately after it has triggered an event being a trigger is a single event under this concept. It does not create a range e.g. 0700 - 1600 and that is why other apps or luup is being widely utilised to meet those types of requirements.

Attached are two documents I did to assist someone else a while ago that were having problem with the “MCV” Automation concept.
I am not sure you need this but I thought I would add it.

[quote=“Brientim, post:9, topic:173998”]Hello WhatIsThisThing,

I gather by the reference you are referring to setting up schedule in a scene directly in your Vera.
As per your example, it is generating two distinct time based triggers determined by the input from the schedule.
So when you use “1 hour and 30 minutes before sunset on Fridays.”, it is calculating the time to trigger based on sunset in your location plus x and there is a simple way to see this… Goto Dashboard > Overview > Upcoming Schedules.
This will display the projected time the schedule will generate the trigger. Using your information when does it stop? Immediately after it has triggered an event being a trigger is a single event under this concept. It does not create a range e.g. 0700 - 1600 and that is why other apps or luup is being widely utilised to meet those types of requirements.

Attached are two documents I did to assist someone else a while ago that were having problem with the “MCV” Automation concept.
I am not sure you need this but I thought I would add it.[/quote]

thank you for taking the time to reply?

i do have to say that the UI is pretty poor if this is the case?.

when you make a blanket statement like “after sunset” it implies (at least to me) that these actions will happen ONLY during that time?(the time after sunset)… Additionally it makes me question what the point of “before/at/after” are because they seem like they would all run at almost the exact same moment in time (1 minute before exactly at and one minute after sunset)

[quote=“RichardTSchaefer, post:8, topic:173998”]

1 hour and 30 minutes before sunset on Fridays

That is a specific moment in time … sunset is computed from your location (lat/long in Setup) and your Timezone. Every day it computes a new sunrise and sunset time. In this example it will trigger at the sunset time value minus 90 minutes.

Those are all examples of setting up a Scene Schedule. But each fires only at 1 specific time each day.

There is an also an Interval Schedule … than can fire at an interval as small as 1 minute.[/quote]

i understand how to do the intervals, though loops are probably more useful as you can check for conditional changes along the way

I am not going to address whether or not it is poor, good or bad, other than to say this is what we currently have to work with. It took me a bit of getting use to their logic but I really do not get phased by this and everyone will have their own opinion.

To the right of the selection is three drop downs which enable you to set the time before and after the selection (after sunrise or before sunset etc). If you select at sunset or at sunrise, you cannot set the time factors… Over the course of the year both sunset and sunrise will change but short day to day it is not much of a variant. However, in some places, like where I am at the moment where it is summer, it really does not start to get dark for about 45 minutes after sunset. It is just an option they make available and you determine if it fits in to what you are doing to schedule.

The reason for Before and After sunset and sundown is not to offset things by 1 minute.
But more like 30 minutes or 1 hour.

Sunrise & Sunset do not mean it’s dark. Many people want to know when it’s dark outside before they
turn on lights.
So they would use (SunSet + 30 Minutes) or (SunRise - 30 Minutes) others might want to do things earlier.
Others do it at a fixed time every day.

Or you might want to turn the heater off during the day when you can get some solar heating:
(SunRise + 2:00) to (SunSet - 2:00)
[hr]
In terms of the style of programming there is the old traditional sequential programming model in which you would do things in a loop. Vera and Most newer UI Models (Websites, Smart Phones, …) use an event driven model. You do not have a running loop … you only have code that reacts to event. The former does not scale and tends to lock up the User Interface.

so earlier i asked about the sensors being detected wrong

my door/window sensors were detected as motion sensors - what is the proper way to get them as a door/window sensor? i made some changes and they appear in the UI as a window sensor now but i can't set triggers on them and i don't know why (beyond i did something wrong

how do i learn how to change them properly?.

In this case, you’ll need to reset them back to their original state.
This is a problem with the implementation of the devices an MCV’s design.
A bug is registered within MCV’s Mantis system.

see http://bugs.micasaverde.com/view.php?id=2399 and
http://forum.micasaverde.com/index.php/topic,4201.0.html

[quote=“Brientim, post:15, topic:173998”]In this case, you’ll need to reset them back to their original state.
This is a problem with the implementation of the devices an MCV’s design.
A bug is registered within MCV’s Mantis system.

see http://bugs.micasaverde.com/view.php?id=2399 and
http://forum.micasaverde.com/index.php/topic,4201.0.html[/quote]

hrm i was told:

click the 'wrench icon' on the device and go to the Advanced tab and make these changes:

device_type: urn:schemas-micasaverde-com:device:DoorSensor:1

device_file: D_DoorSensor1.xml

is this wrong?

is this wrong?
That will definitely get you in trouble .. as I mentioned earlier ... you need to be an expert (or under the direction of an expert) to change the device type for a device.

[quote=“RichardTSchaefer, post:17, topic:173998”]

is this wrong?

That will definitely get you in trouble … as I mentioned earlier … you need to be an expert (or under the direction of an expert) to change the device type for a device.[/quote]ok but this answer isn’t helpful at all as it doesn’t explain WHY ITS WRONG and how one would learn how to do it properly?especially considering the information was provided by MCV support

There is NO FIX yet … There is a bug in MCV code.

The method in which you changed it is the correct; however, it is in the underlying design for simplicity that this problem exists. A simple logic is the sensor is a security sensor and logic say they are either tripped or not… So effectively we only need to display that. Your concern in this case was it was the item is being recorded as a motion sensor but the item was working; however, the icon would not have displayed what you expected either.

For most people, they have came to accept that visually the sensor is being represented as motion sensor but as per the link, there are requests to change this logic and enable users to change this. We live in a visual world and we expect to see things that match and in this case it did not but when you did the changes the icon would have been correct but not working.

The way you changed it was correct and in some cases this maybe effective as in the case of some alarm systems devices that are created in your Vera. So the advice provided by MCV may have be influenced by what was said to them and this their recommendation to change to what they provided but as far as I know, in this case, it will render your device not functional which is what I previously read.

Why is it wrong because it does not match the device specifications and will render it not working and that is beyond our control. This may not be the answer you want or to your liking but it is the core problem in which Richard originally warned you that this may cause problems if you change it. Of course you could go back to MCV and see if they have another answer, fix or something else to rectify your original support request to them but my advice to to revert changes back to Motion and have a functional device for at least now. They last point is before you go and change things in the future always to a backup manually. There is always good advice provided but sometimes things just do not work and people have been caught out having to reset everything and restore.