Virtual device based off Alarm Keypad device, using 'state'

Posted on
Tue Jan 17, 2017 11:13 am
blysik offline
Posts: 213
Joined: Jan 06, 2015

Virtual device based off Alarm Keypad device, using 'state'

Hi,

I'm trying to create a virtual device (which would be exposed to Homebridge) based off of my DSC Alarm plugin keypad device.

The keypad device has a state of 'disarmed', or 'armed'. I would like this to be somehow used for the Virtual Device's off or on status. How can I accomplish this?

Thanks!

Posted on
Tue Jan 17, 2017 11:28 am
Colorado4Wheeler offline
User avatar
Posts: 2755
Joined: Jul 20, 2009
Location: Colorado

Re: Virtual device based off Alarm Keypad device, using 'sta

You can try Device Extensions. This lets you do pretty much precisely what you are asking.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Tue Jan 17, 2017 11:44 am
blysik offline
Posts: 213
Joined: Jan 06, 2015

Re: Virtual device based off Alarm Keypad device, using 'sta

Aha! So use the "v1.5.3 Conversions: Convert to String (and optionally trim)" functionality? Thanks! I'll give that a try.

Posted on
Tue Jan 17, 2017 11:49 am
blysik offline
Posts: 213
Joined: Jan 06, 2015

Re: Virtual device based off Alarm Keypad device, using 'sta

Maybe I'm missing something though. Sure, I could use device extensions that mirrors the state of the keypad correctly. However,it's not a virtual device, so I can't set it's "on" or "off" actions.

Posted on
Tue Jan 17, 2017 3:03 pm
FlyingDiver offline
Posts: 2750
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Virtual device based off Alarm Keypad device, using 'sta

Try my Masquerade plugin and create a sensor device based on the keypad state.

viewtopic.php?f=216&t=17402

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jan 17, 2017 3:10 pm
blysik offline
Posts: 213
Joined: Jan 06, 2015

Re: Virtual device based off Alarm Keypad device, using 'sta

Masquerade sensor has the same problem, doesn't it? I can't assign Action Groups to the on/off commands of the masquerade sensor device.

Posted on
Tue Jan 17, 2017 3:14 pm
FlyingDiver offline
Posts: 2750
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Virtual device based off Alarm Keypad device, using 'sta

blysik wrote:
Masquerade sensor has the same problem, doesn't it? I can't assign Action Groups to the on/off commands of the masquerade sensor device.


Sensor devices have no on/off commands, only on/off status. I thought you were looking for a way to trigger an action group based on the on/off status.

What EXACTLY are you trying to do?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jan 17, 2017 3:19 pm
blysik offline
Posts: 213
Joined: Jan 06, 2015

Re: Virtual device based off Alarm Keypad device, using 'sta

I want to create a new device. The device determines its state from my Alarm Keypad device. I can assign an Action Group to the "on", and another to the "off" of the device. Then, I can expose this device to HomeKit via homebridge.

Essentially, a Virtual Device does what I want, EXCEPT I can't use the keypad state to set its status. (Only a variable.)

Thinking about it more, the only thing I can thing of is to use a trigger on the Keypad somehow to set a variable, that the Virtual Device uses. It would be better to get the state directly, in my mind, however.

Posted on
Tue Jan 17, 2017 3:20 pm
blysik offline
Posts: 213
Joined: Jan 06, 2015

Re: Virtual device based off Alarm Keypad device, using 'sta

Looking at the triggers, I guess I can do this with native indigo. But it seems a little more hackey then I wanted.

Posted on
Tue Jan 17, 2017 5:31 pm
jay (support) offline
Site Admin
User avatar
Posts: 15146
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Virtual device based off Alarm Keypad device, using 'sta

  1. Create a trigger that fires whenever the relevant keypad state changes. You'll need to write a simple script that sets the value of a variable (say, armed_status) to on/off based on whatever mapping you want (see below)
  2. Create Action Groups to Arm/Disarm
  3. Create a Virtual On/Off device using the appropriate Action groups and which uses armed_status as it's state.

Script from step 1
Code: Select all
keypad = indigo.devices[IDOFKEYPADDEVICE]
if keypad.states["nameOfArmedStateHere"] == "armed":
    indigo.variable.updateValue(IDOFVARHERE, "true")
else:
    indigo.variable.updateValue(IDOFVARHERE, "false")


You may be able to use a different plugin to do the value mapping from the above script but I'll leave that as an exercise for you and/or the community.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jan 17, 2017 5:34 pm
jay (support) offline
Site Admin
User avatar
Posts: 15146
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Virtual device based off Alarm Keypad device, using 'sta

Or, yeah, you can probably just do it with triggers.

Nothing built-in is a "hack" by definition... ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests