Meta (Pseudo) Device Plugin

Posted on
Thu Feb 02, 2012 4:33 pm
berkinet offline
User avatar
Posts: 2830
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Meta (Pseudo) Device Plugin

This is an extremely simple, but none-the-less useful plugin. This plugin allows you to create relay type devices which, when operated (on, off or toggle) control either a Group/Scene or an Action. These devices can appear in the DEVICES UI, Control Pages, Indigo-Touch, etc. just the same as any real Indigo device (Like INSTEON or X10)

This allows you to give a "face" to a Group/Scene and takes the place of having to use pseudo X10 devices as triggering elements. If you choose to control a Group/Scene, then the only configuration choice is to enter the Group/Scene number. If you wish to control an Action Group, then you need to specify the Action Group for the On state and another Action Group for the Off state (Presumable the same Action Group could be used for both - but the value of doing so is not clear).

Caveats:
  • This is a Relay device, dimming is not supported.
  • A Group/Scene must be named to be selectable in the plugin.
  • This is beta! IWHFMW (It works here, for me, ware). Please report any problems to this topic or by PM.

The plugin v0.9.3 is available on Dropbox.

Here are the release notes:
v 0.9.2 Feb 04, 2012
    Cleaned up messaging and error display.
    Modified Group/Scene menu to display scene names and numbers.
v 0.9.3 Feb 06, 2012
    Added "Do nothing" as an option.

I am open to adding features, but would like to keep this plugin as simple as possible. In fact, this will probably be the final beta unless I hear some really cool idea.
Last edited by berkinet on Mon Feb 06, 2012 4:51 pm, edited 6 times in total.

Posted on
Thu Feb 02, 2012 4:37 pm
matt (support) offline
Site Admin
User avatar
Posts: 17642
Joined: Jan 27, 2003
Location: Texas

Re: Meta (Pseudo) Device Plugin

Excellent. Thanks for sharing, and I like the idea of keeping this one simple.

Image

Posted on
Fri Feb 03, 2012 11:33 pm
berkinet offline
User avatar
Posts: 2830
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Meta (Pseudo) Device Plugin

BTW, a nice, though unintended, feature of the meta-device plugin is that it can be controlled by AppleScript (and, of course, Python scripts), like any relay device. So, you can use this plugin to add AppleScript control to some other element, like a plugin custom device, that can not be controlled by AppleScript. You just setup the meta-device's On/Off Action Groups to control actions defined by the plugin, or using direct Python scripting if the plugin supports that. Then, you can control the meta-device by a script. The nice thing here is that AppleScripts cannot otherwise execute plugin actions or operate custom plugin devices,

Of course, you can also use the meta-device, via the On and Off Action Groups, to run scripts (Python or AppleScript). This means you can now have a virtual device to control any on/off function that can be controlled by a script - without needing to write plugin. For example, you could create a device that represented, and controlled, a heating system's de-humidifier by scripting the thermostat.

Posted on
Sat Feb 04, 2012 9:35 am
jay (support) offline
Site Admin
User avatar
Posts: 13043
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Meta (Pseudo) Device Plugin

berkinet wrote:
...AppleScripts cannot otherwise execute plugin actions...


Not strictly true - since (like your pseudo devices) AppleScripts can directly execute Action Groups...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Feb 20, 2012 12:03 am
berkinet offline
User avatar
Posts: 2830
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Meta (Pseudo) Device Plugin

Version 0.9.6 of the Meta Device plugin is now available on dropbox

This release fixes a serious bug affecting relay type devices.

See the Meta Device Announcements topic for more information.

Posted on
Thu Aug 09, 2012 4:37 am
berkinet offline
User avatar
Posts: 2830
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Meta (Pseudo) Device Plugin

Version 0.9.7 of the Meta Device plugin is now available on dropbox

This release adds two actions to set the onOffState of a device to True or False. This allows meta devices to be updated asynchronously. That is, the action on On or Off might manage the device but not be aware of its state. But, some other interface (sensor, digital I/O, etc.) might be able to determine the state and, therefore, update the meta device's state in the DEVICES window. So, instead of a simple stateless toggle, you can have a truly stateful device.

See the Meta Device Announcements topic for more information.

Posted on
Thu Aug 09, 2012 10:02 am
terrydew offline
Posts: 257
Joined: Jun 10, 2011

Re: Meta (Pseudo) Device Plugin

Just updated to 9.7 and the only actions available are

Do nothing
Exec Scene
Exec Action Group

Do not see any thing related to onoffstate.

I have been wanting a toggle function for a control device and I just figured out that this plugin gives it to me. Thanks

Terry

Posted on
Thu Aug 09, 2012 10:35 am
berkinet offline
User avatar
Posts: 2830
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Meta (Pseudo) Device Plugin

Try...

New Action Group -> plugin -> Meta-Device, then select the function (true or false) and select the device.

Posted on
Thu Aug 09, 2012 10:51 am
terrydew offline
Posts: 257
Joined: Jun 10, 2011

Re: Meta (Pseudo) Device Plugin

Ok. Thanks. I was in device setup. I see it now. Why would I want to use this? Could you give me a simple example of it's use. I probably need it but just don't know it.

You don't know what you don't know. :D

Posted on
Thu Aug 09, 2012 3:16 pm
berkinet offline
User avatar
Posts: 2830
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Meta (Pseudo) Device Plugin

The main idea of the Meta-Device plugin is to give a visible face (instantiation) to a virtual device. That is, some device that has no direct physical representation in Indigo. Typically, this would be some software function controlling some arbitrary external hardware.

In the original version of the software it was assumed that the only way to control the virtual device (I.e. the software) was through the Meta-Device and the associated On/Off actions. This tight coupling avoided any need for synchronization between the actual state of the software and the displayed state of the Meta-Device.

However, I realized that there were cases in which the external hardware might be operated by other inputs, not visible to Indigo. Therefore, there needed to be some way for Indigo to update the visible state of the Meta-Device to match the actual state of the software interface. That is what these two actions are for.

For a real world example, see this thread.

Posted on
Sat Aug 11, 2012 2:12 pm
nsheldon offline
Posts: 1810
Joined: Aug 09, 2010
Location: CA

Re: Meta (Pseudo) Device Plugin

Greetings.

I just installed the 0.9.7 version of the Meta Device plugin and have setup a Meta Dimmer device to provide a dimmer-like interface for the receiver volume level (esp. useful within Indigo Touch where there's a slider to set the dimmer level). Unfortunately, every time I attempt to set the brightness level of the virtual dimmer device I'm seeing an error in the log and the associated brightness change Action Group is not executed. Enabling "Intense Debugging" in the Meta Device configuration doesn't really show where the error is coming from. Some logs are below. I did the following to produce the logs. Reload the Meta Device plugin. Create a new Meta Dimmer device, selecting an Action Group for ON, a different Action Group for OFF, and a different Action Group for response to change in brightness. Then set the brightness level using the UI slider in the Indigo Cocoa client.

Code: Select all
  Starting plugin "Meta Device 0.9.7" (pid 39182)
  Plugin "Meta Device" connected
  Meta Device                     Log level preferences are set to "Intense Debug".
  Plugin "Meta Device 0.9.7" started
  Meta Device                     Plugin startup.
  Meta Device Debug               versionCheck() called
  Meta Device                     url:http://yikes.com/plugins/metadevice.html
  Meta Device                     Your plugin version, v0.9.7, is current.

Aug 11, 2012 1:01:31 PM
  Meta Device Debug               SCENE num:1, name:All Outdoor Lights KeypadLinc Button 4
  Meta Device Debug               SCENE num:2, name:Garage Light KeypadLinc Button 3
  Meta Device Debug               SCENE num:3, name:Patio Light KeypadLinc Button 3
  Meta Device Debug               SCENE num:4, name:Back Yard Motion Light
  Meta Device Debug               SCENE num:5, name:Driveway Motion Light
  Meta Device Debug               SCENE num:6, name:Garage Light KeypadLinc Button 6
  Meta Device Debug               SCENE num:50, name:All Indoor Lights
  Meta Device Debug               SCENE num:51, name:All Outdoor Lights
  Meta Device Debug               SCENE num:, name:
  Meta Device                     validating Device Config called
  Meta Device Debug               Device validation received:UiValuesDict : (dict)
     label1 :  (string)
     metaDevBrightAction : 1106158489 (string)
     metaDevBrightMode : 2 (string)
     metaDevGroupScene :  (string)
     metaDevGroupSceneNote :  (string)
     metaDevOffAction : 182562107 (string)
     metaDevOnAction : 1332647967 (string)
     metaDevOnMode : 2 (string)
  SQL Logger                      creating table device_history_1792006338 for "Receiver Volume"
  Meta Device                     metaMode:2
  Meta Device Debug               device brightness set to:
actionValue : 30
delayAmount : 900
description : brighten device to 30%
deviceAction : SetBrightness
deviceId : 1792006338
replaceExisting : True
textToSpeak :
  Meta Device Receiver Volume Error send "Receiver Volume" set brightness to 30 failed

The on and off device changes (i.e. when I turn on or off the Meta Dimmer in the Indigo client) work fine. Changing the brightness to anything other than 0 or 100 produces the above error. Did I miss something? Let me know if you need more information.

Posted on
Sat Aug 11, 2012 8:43 pm
nsheldon offline
Posts: 1810
Joined: Aug 09, 2010
Location: CA

Re: Meta (Pseudo) Device Plugin

Okay, I found the problem and was able to fix it.

On line 43-44 of the plugin.py file, in the actionControlDimmerRelay() method, for some reason the hasattr call in the if statement wasn't returning a value of True, causing the brightMode variable to not be assigned before being called in the various subsequent brightness change conditions. Also, in all of the brightness change conditions (SetBrightness, BrightenBy, DimBy), the code was written to call the Action Group associated with the "metaDevOffAction" plugin property rather than the "metaDevBrightAction" as expected. After fixing the above items, the Meta Dimmer device worked as expected with no errors.

I fixed the hasattr call issue by changing the if statement to
Code: Select all
brightMode = dev.pluginProps.get('metaDevBrightMode', "")
so that even if the property isn't defined, the brightMode will be assigned an empty string.

Posted on
Sun Aug 12, 2012 1:36 pm
berkinet offline
User avatar
Posts: 2830
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Meta (Pseudo) Device Plugin

Thanks to @nsheldon's help, the Meta-Device plugin beta 0.9.8 is now available on Dropbox.

Changes include bug fixes for dimmer type devices, a new set brightness action and better error checking.

Posted on
Sun Aug 12, 2012 1:40 pm
nsheldon offline
Posts: 1810
Joined: Aug 09, 2010
Location: CA

Re: Meta (Pseudo) Device Plugin

Awesome! Works perfectly. Thanks for the update.

Posted on
Thu Oct 18, 2012 7:02 am
mikeL online
Posts: 42
Joined: Apr 30, 2010
Location: Gatineau, QC

Re: Meta (Pseudo) Device Plugin

Where can I get version 0.9.9 that I understand is now available?
Mike

Who is online

Users browsing this forum: No registered users and 2 guests

cron