We have moved at community.getvera.com

Author Topic: Plugin - IPhone Locator  (Read 280802 times)

Offline tamorgen

  • Full Member
  • ***
  • Posts: 130
  • Karma: +2/-0
Re: Plugin - IPhone Locator
« Reply #990 on: February 02, 2019, 09:37:41 pm »
Is there a way to set variables that aren't present in UPNP through LUUA?  I'm playing with a guest mode, using the location of my iMac (fixed).  I had a baby sitter over last night while we were out, and the house kept going into Away mode, turning the thermostat into Eco mode and turning off lights., because both iPhones participating in Home mode were away.  I'm tinkering with making the a virtual switch actings as a trigger and condition, and the action would be to set the third iPhoneLocator instance using my Mac's location, and setting it to a participant when the GuestMode switch is set to on. 

Offline sebby

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +15/-3
Re: Plugin - IPhone Locator
« Reply #991 on: February 03, 2019, 08:55:42 am »
i use the Reactor plugin, it works beautifully.  i created a virtual switch and a reactor sensor checks to see if both phones are away (at a certain distance) OR the switch is off to set the away mode.  i also have another Reactor that resets the virtual switch after 24 hours of being triggered, so i don't have to remember to manually reset it.  Highly recommend using Reactor and the iphone locator together.

Offline tamorgen

  • Full Member
  • ***
  • Posts: 130
  • Karma: +2/-0
Re: Plugin - IPhone Locator
« Reply #992 on: February 03, 2019, 09:39:27 am »
Sebby,
I use PLEG for the most part, and I know I can do what I need to with it, but not all of the variables are available from the PLEG actions menu.  I believe the only way i can change that HouseModeActor boolean is through LUUA code, which I really don't have any experience with.  I think the only way I could do what you are describing with Reactor is to disable to HouseModeActor in all the iPhoneLocator instances and us Reactor exclusively to set Home/Away mode.  I can probably do the same with PLEG, but I'm just trying to see if I can do it with one line of LUUA code and set the that variable.

Either way, the 24 hour reset isn't a bad idea.  I was also thinking of disabling the GuestMode virtual switch if either of the iPhoneLocator instances returned to Home mode.
« Last Edit: February 03, 2019, 09:41:15 am by tamorgen »

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: Plugin - IPhone Locator
« Reply #993 on: February 03, 2019, 09:48:21 am »
Is there a way to set variables that aren't present in UPNP through LUUA?  I'm playing with a guest mode, using the location of my iMac (fixed).  I had a baby sitter over last night while we were out, and the house kept going into Away mode, turning the thermostat into Eco mode and turning off lights., because both iPhones participating in Home mode were away.  I'm tinkering with making the a virtual switch actings as a trigger and condition, and the action would be to set the third iPhoneLocator instance using my Mac's location, and setting it to a participant when the GuestMode switch is set to on.

a simple luup line of code can control this with 0 to disable or 1 to enable the participation in the house mode calculation at each refresh
Code: [Select]
luup.variable_set("urn:upnp-org:serviceId:IPhoneLocator1", "HouseModeActor",0, deviceid)

it is your choice where to put that line, can be in a scene , triggered by some event like your virtual switch.  remember scene lua code must finish by a line with
Code: [Select]
return trueif you want the scene to execute

Offline tamorgen

  • Full Member
  • ***
  • Posts: 130
  • Karma: +2/-0
Re: Plugin - IPhone Locator
« Reply #994 on: February 03, 2019, 11:46:29 am »
Thank you sir!  That's exactly what I was looking for.

Is there a way to set variables that aren't present in UPNP through LUUA?  I'm playing with a guest mode, using the location of my iMac (fixed).  I had a baby sitter over last night while we were out, and the house kept going into Away mode, turning the thermostat into Eco mode and turning off lights., because both iPhones participating in Home mode were away.  I'm tinkering with making the a virtual switch actings as a trigger and condition, and the action would be to set the third iPhoneLocator instance using my Mac's location, and setting it to a participant when the GuestMode switch is set to on.

a simple luup line of code can control this with 0 to disable or 1 to enable the participation in the house mode calculation at each refresh
Code: [Select]
luup.variable_set("urn:upnp-org:serviceId:IPhoneLocator1", "HouseModeActor",0, deviceid)

it is your choice where to put that line, can be in a scene , triggered by some event like your virtual switch.  remember scene lua code must finish by a line with
Code: [Select]
return trueif you want the scene to execute