State changes for variable devices?

Posted on
Tue Jun 25, 2019 5:49 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

State changes for variable devices?

Okay, so sorry if these are dumb questions (I know i can trial-n-error for answers but I’m trying to plan what i’ll do next time i curl up with Indigo):
Q: If i delete a variable used for the plugin device, will that render that plugin device, or even the whole plugin, inoperable?
Q: Can i modify plugin defined states (i recall that being a potential “no,” but i may be thinking of plugin “props”, and i am now having bad flashbacks to my first swings and strike-out at writing a plugin)

Thanks again @howartp

Posted on
Tue Jun 25, 2019 11:21 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: State changes for variable devices?

1) Correct, that device will stop updating.

2) I’m not sure what you’re rambling on about (?!) but you can’t modify my plugin states.


Sent from my iPhone using Tapatalk Pro

Posted on
Wed Jun 26, 2019 2:54 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

State changes for variable devices?

^ Sorry, the ramble was my attempt to joke about my own lack of knowledge.

To give a more clear example:

I have an Indigo Variable “foo”.
I create a device with your plugin and name it “TestDevice”, using “foo” as a variable from which to create a custom device state.
The device now has a custom state, also called “foo.”

In a script, can I write:
indigo.device[“TestDevice”].updateStateOnServer(“foo”, value=“bar”)

I recall there being some plugin-related states or props for which ONLY the plugin itself could modify the value.

I hope this is more clear.

Many thanks

Posted on
Wed Jun 26, 2019 3:06 pm
FlyingDiver offline
User avatar
Posts: 7211
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: State changes for variable devices?

mundmc wrote:
I recall there being some plugin-related states or props for which ONLY the plugin itself could modify the value.


That would be all of them. AFAIK, only the plugin can modify plugin states or properties.

But doesn't changing the variable change the plugin state, for these devices?

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

Posted on
Wed Jun 26, 2019 3:54 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: State changes for variable devices?

Not sure that this is what you're looking for, but the Global Properties Manager plugin allows you to modify global properties for a device (many plugin devices won't have any of those) and to add custom properties to a device (IIRC, you can add those to any Indigo device). The Global Properties Manager plugin has special privileges granted by the Indigo Server (it's an Indigo Domotics plugin). But it only changes properties and not device states.

I think that a plugin author could possibly include an API to allow users to change states for its own devices, but this would be a one-off thing and I don't know of any plugins that allow this (that doesn't mean that there aren't any.) That is of course not counting plugins that allow you to define states through the plugin interface itself (like my Announcements Plugin whose sole purpose is to allow users to create custom state values.)

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Jun 26, 2019 4:20 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: State changes for variable devices?

Thank you so much everybody for making this clear to me. I have looked at Global Property Manager, but i hope to have some kind of state that can have it’s own values modified. I really need to take another stab at writing a plugin. In this case, I just want a device type that can represent “rooms,” and all of their related data (device id’s for motion sensors, adjacent rooms, id’s for lights in that room, id’s for action groups unique to that room, id’s for airfoil speakers etc.).

Still a handy plugin for flexibility!

Posted on
Wed Jun 26, 2019 6:24 pm
jay (support) offline
Site Admin
User avatar
Posts: 18212
Joined: Mar 19, 2008
Location: Austin, Texas

Re: State changes for variable devices?

FYI, the Virtual Devices plugin offers an action (Set Virtual On/Off Device State) that directly modifies the onOffState (and, therefore, the onState property because it's a mirror of the onOffState state) of a virtual device. My point is that if a developer wants to give users the ability to directly set a state, then they can/should provide an action to do it (which can also be exposed as an API that a script could also use).

If you don't mind my asking, what exactly would a device such as you're describing be used for?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Jun 26, 2019 7:34 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: State changes for variable devices?

Hi Jay,

Only marginally relevant to howartp’s plugin, so feel free to file/delete.

I often run into situations where I wish I had some representation of a room, and everything Indigo in the room.

Examples.:
Easily selecting values to be displayed in Control Pages, like LivingRoom.temperature, Kitchen.occupied, Den.musicSource
At present, i use a nomenclature for names, like SWITCH_KITCHEN_recessedLights for devices, or MULTISENSOR_KITCHEN_motion

Another goal is to have rooms reference their neighbors.
Ex.:
if Kitchen.motion:
#turn on kitchen lights
#for neighbor in Kitchen.neighbors:
#turn on neighbor.lights

Also, i still have a pipe dream about more accurate room occupancy detection, checking neighboring rooms for motion to get a sense of a vector, aiming for “smarter” prediction.

Posted on
Thu Jun 27, 2019 9:43 am
jay (support) offline
Site Admin
User avatar
Posts: 18212
Joined: Mar 19, 2008
Location: Austin, Texas

Re: State changes for variable devices?

mundmc wrote:
Hi Jay,

Only marginally relevant to howartp’s plugin, so feel free to file/delete.

I often run into situations where I wish I had some representation of a room, and everything Indigo in the room.

Examples.:
Easily selecting values to be displayed in Control Pages, like LivingRoom.temperature, Kitchen.occupied, Den.musicSource
At present, i use a nomenclature for names, like SWITCH_KITCHEN_recessedLights for devices, or MULTISENSOR_KITCHEN_motion

Another goal is to have rooms reference their neighbors.
Ex.:
if Kitchen.motion:
#turn on kitchen lights
#for neighbor in Kitchen.neighbors:
#turn on neighbor.lights

Also, i still have a pipe dream about more accurate room occupancy detection, checking neighboring rooms for motion to get a sense of a vector, aiming for “smarter” prediction.


I see. Folders are the usual organization structure, and #1 could be solved by making the selector controls show them (it's amazingly time consuming and code intensive to build hierarchical menus in Cocoa - at least targeting the 10.7 SDK as we are). It's on the list, but never seems to be of sufficiently high priority for us to address it.

#2 definitely falls outside of just an organization since a room in that instance is actually a rollup of a variety of devices. Your syntax won't work because we don't allow custom devices to specify their own properties (just states) and devices can't implement multiple device types (on/off, dimmer, thermostat, etc) in the same device definition (think of it as single inheritance only). And of course it's unclear what your example is (a script? pseudo language for UI logic of some kind?). So my guess is that you're probably not going to be satisfied with whatever you can construct given the current API (but I could be wrong).

I suspect the best you could do is create a aggregator device of all motion-type detection stuff in a given room (multiple motion sensors or other occupancy things) where your plugin would get updates from those devices and use whatever internal logic to set the state of the aggregate device accordingly. Somewhat like what we do with Device Groups but tailored to a broader range of input devices (if you're only rolling up devices that are on/off devices then a Device Group might work for you).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Jun 27, 2019 4:27 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: State changes for variable devices?

I’m intrigued by this conversation and MundMC’s fantasy.

State-only “room” devices could be used to pull together values from other devices, such that lounge.temperature (devices[‘lounge’].getState[‘temp’]) could work.

Then on a CP, you’re picking states of a device, rather than devices from a humongous scrolling list.

Neighbours could be defined by a doorway device, with two room device IDs being stored.

Then each (room.getDoorway) would give you the room IDs of neighbours.

(All pseudocode...)


Sent from my iPhone using Tapatalk Pro

Posted on
Fri Jun 28, 2019 12:58 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

State changes for variable devices?

Thanks, Jay, for your explanations, and howartp I am flattered to contribute an intriguing idea- you are exactly on to my meaning.

Jay- you are spot on re: virtual device groups. At present, my Indigo ecosystem heavily relies on virtual device groups, the Group Change Listener, the Timed Devices plugin, and a lot of scripting.

I run into trouble with the Virtual Device Groups plugin and it’s (deliberate and thoughtful) limitation on having virtual devices within a virtual device group. I try to get around this with the Masquerade plugin, the Device Extensions plugin, and now, the Variable Devices plugin.

I run into problems when I want to do something “relational” between two or more devices, or between two or more groups of devices- it gets hairy pretty quick, and i have little margin of error before I get threats from my wife.

Anyway, thanks for the thoughtful responses!

Posted on
Sun Jun 30, 2019 9:32 am
Grognard offline
User avatar
Posts: 53
Joined: May 17, 2011
Location: Seabrook, TX

Re: State changes for variable devices?

You might also take a look at the "Timed Devices" plugin on the plugin store http://www.indigodomo.com/pluginstore/88/, I've used this to good effect for this sort of thing for a couple years and really like it. Using the aforementioned plugin I have a virtual device which tracks a door switch and three motion sensors that is a pretty accurate countdown timer on presence detection in my daughter's room (she gets VERY annoyed when her lights go out in her room while she is in there, but she is terrible about turning them off when she leaves).

Posted on
Sun Jun 30, 2019 10:25 am
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: State changes for variable devices?

^Oh yeah, Timed Devices is one of my staples!

Posted on
Wed Dec 16, 2020 9:02 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: State changes for variable devices?

mundmc wrote:
Examples.:
Easily selecting values to be displayed in Control Pages, like LivingRoom.temperature, Kitchen.occupied, Den.musicSource
At present, i use a nomenclature for names, like SWITCH_KITCHEN_recessedLights for devices, or MULTISENSOR_KITCHEN_motion


I'm kinda working on something similar at the moment... (That's how I landed here..... scrolling the forum trying to figure out a bit of code)... it will be my first ever plugin, but it's a state only plugin. Instead of being room-centric, it is human-centric. so Vikki.CellPhone, Vikki.Email1Address, etc. If I ever get it figured out, I'm guessing it wouldn't be hard to change stuff like "phone" to "light" except I guess there would be 2 of every state... one label state one state state.... like LivingRoom.Light1Name = floor lamp. LivingRoom.Light1Status = On.

Now when you start taking about neighbor devices and how to figure that out.... totally drawing a blank. I live in a house of 7... there is motion and log activity constantly and there is no predicting of their behavior.

At the rate I'm going, I should have a distributable beta version by Spring 2023.

Bill
My Plugin: My People

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest