Help with Proper Logic to Turn on Lights When Coming Home

@rigpapa

Thanks again; Much obliged!

Take care of yourself first. This is a matter of convenience not necessity!

OK. Sorry this took a bit, but as youā€™ve seen Iā€™m also working with another community user on an issue, and it actually overlaps the issues here a bit, in addition to prior updates and work not yet released.

Please grab the current Github stable branch version (19178) and install it, all files. Youā€™ll need to restart Luup and hard refresh your browser as well.

After you get this installed, send me a logic summary, so I know what your current configuration looks like. But I believe what you showed in this post should work. Iā€™m not 100% on the StartingActivityId test because I donā€™t use Harmony, so I donā€™t know what the values mean or have a feel for the behavior and timing of the device. But letā€™s see what happens. Keep an eye on your Status tab display while testing; thatā€™s usually informative, too.

Edit: install instructions, if neededā€¦

  1. Go to the Github stable branch
  2. Click the green ā€œClone or downloadā€ button and choose ā€œDownload ZIPā€
  3. Unzip the zip file to a folder.
  4. Upload the unzipped files by selecting them all and dragging the group to the upload tool at Apps > Develop apps > Luup files. This will also reload Luup after the uploads are done.
  5. Hard-refresh your browser.

Iā€™ve tested Harmony for that command and state.

Harmony remotes have several Audio Video Activities that start up various devices as programmed. Power turns everything off. This corresponds to StartingActivityId = -1 from my testing with Reactor. When an activity is being used it returns an 8 digit numeric codeā€¦

Iā€™ll install this beta and report back. Should be interesting using Jump Desktop RDP from my phone at work!

Thereā€™s AltUI and Readme files in thereā€¦ drop ALL of them into Vera?

You can skip the ā€œ.mdā€ files, but everything else should go.


*************************************************** REACTOR LOGIC SUMMARY REPORT ***************************************************
   Version: 3.3develop-19178 config 19178 cdata 19082 ui 19178 pluginDevice 558
    System: Vera version 1.7.4453 on Sercomm G450; loadtime 1561667912; systemReady 1561667948; Lua 5.1
Local time: 2019-06-27T13:46:53-0700; DST=1; Redacted
House mode: plugin 1; system 1; tracking on
  Sun data: { "stamp": 2019178, "civdawn": 1561637477, "nautdawn": 1561635324, "sunset": 1561691074, "nautdusk": 1561694976, "latitude": Redacted, "astrodusk": 1561697334, "longitude Redacted, "civdusk": 1561692824, "astrodawn": 1561632967, "sunrise": 1561639227 }
  Geofence: running in long mode, last update 06:48:00, data version 2
            User 1686711 ishome=0 inlist= since=06:48:00
            |1472309878 "Redacted" type="home" status="out" since=06:48:00
            User 1686611 ishome=1 inlist=1 since=06:48:00
            |    1 "Redacted" type="home" status="in" since=18:34:00
            User 2497352 ishome=1 inlist=1559003821 since=06:48:00
            |1559003821 "Redacted" type="home" status="in" since=16:37:00
            Raw: { "updated": 1561668360, "users_settings": [ { "id": 1686611, "ishome": 1 }, { "id": 1686711, "ishome": 0 }, { "id": 2497352, "ishome": 1 } ], "mode": -1, "users": [ { "id": 1686711, "Level": 1, "Name": "Meritage1", "IsGuest": 0 }, { "id": 1686611, "Level": 1, "Name": "Meritage10", "IsGuest": 0 }, { "id": 2497352, "Level": 1, "Name": "TaylorS", "IsGuest": 0 } ], "usergeofences": [ { "geotags": [ { "radius": 250, "PK_User": 1686611, "id": 1, "status": "Enter", "accuracy": 0, "ishome": 1, "name": "Redacted", "address": "Redacted", "longitude": "-Redacted", "latitude": "Redacted", "color": "006e45", "notify": 1 } ], "iduser": 1686611 }, { "geotags": [ { "radius": 100, "PK_User": 1686711, "id": 1472309878, "status": "Exit", "accuracy": 0, "ishome": 1, "name": "Redacted", "address": "Redacted ", "longitude": Redacted", "latitude": "Redacted", "color": "#ff0000", "notify": 1 } ], "iduser": 1686711 }, { "geotags": [ { "radius": 250, "notify": 1, "id": 1559003821, "status": "Enter", "color": "ff0000", "ishome": 1, "name": "Redacted", "address": "Redacted", "longitude": Redacted", "latitude": "Redacted", "accuracy": 0, "PK_User": 2497352 } ], "iduser": 2497352 } ] }
====================================================================================================================================
Welcome Home (#574) tripped
    Version 19082.87 06/26/19 08:12:09
    Message/status: Tripped
    Test time set: 2019-06-25 01:39
    Condition group "Mode to Home, @Night TV OFF" (AND) TRUE as of 06-25.01:39:00 <root>
      &-T-sun bet civdusk+0,civdawn+0 [1561643072 => 1561451940 at 06-25.01:39:00; T/T as of 06-25.01:39:00/06-25.01:39:00] <condetd8e76>
      &-T-service Harmony Control (351) urn:rboer-com:serviceId:Harmony1/StartingActivityID = -1 (match case) [32003180 => -1 at 06-25.01:39:00; T/T as of 06-25.01:39:00/06-25.01:39:00] <condetd8z3x>
      &-T-housemode in ,1 after condetd8z3x [2 => 1 at 06-25.01:39:00; T/T as of 06-25.01:39:00/06-25.01:39:00] <condesewo4s>
      &-T-housemode in ,1 after condetd8e76 [2 => 1 at 06-25.01:39:00; T/T as of 06-25.01:39:00/06-25.01:39:00] <condetkygr8>
    Activity grpetdaz2k.true
        Device Fam Room Light & Fan (199) action urn:upnp-org:serviceId:SwitchPower1/SetTarget( newTargetValue="0" )
        Device Tripod Dimmer (26) action urn:upnp-org:serviceId:SwitchPower1/SetTarget( newTargetValue="0" )
    Activity root.true
        Device Fam Room Light & Fan (199) action urn:upnp-org:serviceId:SwitchPower1/SetTarget( newTargetValue="1" )
        Device Tripod Dimmer (26) action urn:upnp-org:serviceId:Dimming1/SetLoadLevelTarget( newLoadlevelTarget="50" )
    Events
        06/27/19 13:38:56 reload: notice=Luup reload
        06/27/19 13:38:56 disabled at startup: 
        06/27/19 13:41:14 action: action=Restart
        06/27/19 13:41:14 disabled at startup: 
        06/27/19 13:41:20 action: action=Reset
        06/27/19 13:41:20 sensorstate: state=false
        06/27/19 13:41:41 action: action=Restart
        06/27/19 13:41:41 disabled at startup: 
        06/27/19 13:42:37 action: action=SetEnabled, state=1
        06/27/19 13:42:37 action: action=Restart
        06/27/19 13:42:37 start: 
        06/27/19 13:42:38 condchange: newState=true, cond=condetd8e76, oldState=false
        06/27/19 13:42:38 evalchange: newState=true, cond=condetd8e76, oldState=false
        06/27/19 13:42:38 condchange: newState=false, cond=condetd8z3x, oldState=true
        06/27/19 13:42:38 evalchange: newState=false, cond=condetd8z3x, oldState=true
        06/27/19 13:42:38 evalchange: newState=true, cond=condetkygr8, oldState=false
        06/27/19 13:42:40 action: action=SetEnabled, state=0
        06/27/19 13:43:46 action: action=SetEnabled, state=1
        06/27/19 13:43:47 action: action=Restart
        06/27/19 13:43:47 start: 
        06/27/19 13:43:48 condchange: newState=false, cond=condesewo4s, oldState=true
        06/27/19 13:43:48 condchange: newState=false, cond=condetkygr8, oldState=true
        06/27/19 13:43:48 evalchange: newState=false, cond=condetkygr8, oldState=true
        06/27/19 13:44:08 devicewatch: name=Reactor Plugin, var=HouseMode, device=558
        06/27/19 13:44:08 condchange: newState=true, cond=condesewo4s, oldState=false
        06/27/19 13:44:08 condchange: newState=true, cond=condetkygr8, oldState=false
        06/27/19 13:44:08 evalchange: newState=true, cond=condetkygr8, oldState=false
        06/27/19 13:44:18 devicewatch: name=Reactor Plugin, var=HouseMode, device=558
        06/27/19 13:44:18 condchange: newState=false, cond=condesewo4s, oldState=true
        06/27/19 13:44:18 condchange: newState=false, cond=condetkygr8, oldState=true
        06/27/19 13:44:18 evalchange: newState=false, cond=condetkygr8, oldState=true
        06/27/19 13:44:52 devicewatch: name=Reactor Plugin, var=HouseMode, device=558
        06/27/19 13:44:52 condchange: newState=true, cond=condesewo4s, oldState=false
        06/27/19 13:44:52 condchange: newState=true, cond=condetkygr8, oldState=false
        06/27/19 13:44:52 evalchange: newState=true, cond=condetkygr8, oldState=false
        06/27/19 13:45:16 devicewatch: device=351, old="32003180", name=Harmony Control, var=urn:rboer-com:serviceId:Harmony1/StartingActivityID, new="-1"
        06/27/19 13:45:16 condchange: newState=true, cond=condetd8z3x, oldState=false
        06/27/19 13:45:16 evalchange: newState=true, cond=condetd8z3x, oldState=false
        06/27/19 13:45:16 evalchange: newState=true, cond=condesewo4s, oldState=false
        06/27/19 13:45:16 condchange: newState=true, cond=root, oldState=false
        06/27/19 13:45:16 evalchange: newState=true, cond=root, oldState=false
        06/27/19 13:45:16 sensorstate: state=true
        06/27/19 13:45:16 startscene: scene=root.true, sceneName=root.true
        06/27/19 13:45:16 runscene: scene=root.true, sceneName=root.true, group=1, notice=Starting scene group 1
        06/27/19 13:45:16 endscene: scene=root.true, sceneName=root.true
```
 

It worked for all except when powering down Harmony Control Between Dusk and Down in Home Mode. That still triggered the lights to go on.

OK, now, the reason for that seems to be that the test time forces all the eval times to have a common baseā€“by freezing the operation of the RS to one moment in time, youā€™re also making the sequence condition true because it thinks the house mode change is happening contemporaneouslyā€“youā€™ve stopped time from flowing and everything is now happening in the same instant.

This surprisingly complex set, unfortunately, is going to need to be tested in real time only. Or, you can test by modifying your sunrise/sunset to date/time with real times inside and outside the current real time of day. Just donā€™t use test time.

Makes perfect sense. Iā€™ll change the time limitations to test and report back. Then Iā€™ll try it again tonight. Thank you so much for the ā€œHot Fixā€!

I find it difficult to keep track of the entire branch, maybe the offer has already been tried ā€¦
And if you take out the TV in a separate module, put the latch and add another ā€œHouse modeā€ to it?
While the mode does not change, do with the TV anything ā€¦

Seemed to work last night but I need to keep testing as I wasnā€™t first home after dusk but the lights were on.

2 posts were split to a new topic: [Moved] Detecting lock unlocks/user codes

My problem is that there are two people living here, so I donā€™t want to have a motion sensor that toggles the lights on and off everytime someone opens the door and leaves, or have people coming over for a visitā€¦Is there a way I can have the lights turn on when Iā€™m home, and remain that way until I switch it off myself, or maybe have it programmed to turn off at a specific time? VidMate.vin Apk9Apps.com

As per comment request, I only have a LIFX smart bulb currently.

Sure, you would just express this in the logic and actions. Either omit the action to turn the lights off and rely on a human to do it, or trigger at a specific time, or perhaps even have a ā€œcatch allā€ that turns them off at a certain time (e.g. 2am) unless youā€™re in ā€œparty modeā€ or turns them off if theyā€™ve been on for 6/8/12 hours, ā€¦ Itā€™s really up to what you decide.