Device state - not working

SMUSEBY
Posts: 638
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Device state - not working

Post by SMUSEBY »

I've tried two ways to report the device state as I read the documentation (one at the bottom of the plug-in, the other from documentation), and neither is inserting the device state into the email message created.

Two lines from my better email plug-in:

Code: Select all

The Tank temperature is %%d:892742387:StateID%%.
Tank is now %%d:163642000:someStateID%%.
Resulting in the email message,
The Tank temperature is .
Tank is now .

Note: the tank temperature is a Phidgets device, not a variable.
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Device state - not working

Post by FlyingDiver »

SMUSEBY wrote:I've tried two ways to report the device state as I read the documentation (one at the bottom of the plug-in, the other from documentation), and neither is inserting the device state into the email message created.

Two lines from my better email plug-in:

Code: Select all

The Tank temperature is %%d:892742387:StateID%%.
Tank is now %%d:163642000:someStateID%%.
Resulting in the email message,
The Tank temperature is .
Tank is now .

Note: the tank temperature is a Phidgets device, not a variable.
Why do you not have the actual state name/ID in there?
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
SMUSEBY
Posts: 638
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Device state - not working

Post by SMUSEBY »

I used the device ID.
What is the "actual state name ID"?
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Device state - not working

Post by FlyingDiver »

SMUSEBY wrote:I used the device ID.
What is the "actual state name ID"?
Devices have states. You need to identify which state you want in there. I'm not a Phidgets user, so I don't know what those devices use. If it's a simple value sensor (one value per device), use "sensorValue" if you want the raw number, "sensorValue.ui" if you want the formatted number that's shown in the Indigo UI.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
SMUSEBY
Posts: 638
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Device state - not working

Post by SMUSEBY »

what value do I use for a device (on or off?)?
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Device state - not working

Post by FlyingDiver »

SMUSEBY wrote:what value do I use for a device (on or off?)?
An on/off sensor, like a motion sensor? That would be 'onOffState'.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
SMUSEBY
Posts: 638
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Device state - not working

Post by SMUSEBY »

Not a sensor; for this instance, I want the on/off state for a device.
Is there a list of Indigo states that would be appropriate for this field? I'm guessing that the syntax needs to be precise.
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Device state - not working

Post by FlyingDiver »

SMUSEBY wrote:Not a sensor; for this instance, I want the on/off state for a device..
A sensor is a device.
SMUSEBY wrote:Is there a list of Indigo states that would be appropriate for this field? I'm guessing that the syntax needs to be precise.
You need to take this over to the Phidgets forum/thread. This is not a Better Email issue. The states are defined by the plugin, unless it's derived from a standard Indigo base device. In which case it'll be one of the state names I already gave you.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
SMUSEBY
Posts: 638
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Device state - not working

Post by SMUSEBY »

OK.
Thanks.
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Device state - not working

Post by matt (support) »

In the Main Window grab the divider above the Device Details section and drag upward to expose all of the Custom States defined by the device. So in the case below which is for a Timer device the stateIDs that could be used are longStatusString, timeLeftDays, etc. Not shown in that list will be the non-custom states, which are the ones built-in to the device type. So for example, an On/Off Relay device or an On/Off Sensor device always has a state of onOffState defined (which might be what you are after). Other examples, a dimmer device always has brightnessLevel. You can also log all of the states to the Event Log by choosing the Plugins->Open Scripting Shell menu item then pasting in something like this (substitute in correct device ID you are interested in for someDevIdHere):

indigo.server.log(unicode(indigo.devices[someDevIdHere].states))
Attachments
Screen Shot 2019-10-06 at 12.29.59 PM.png
Screen Shot 2019-10-06 at 12.29.59 PM.png (169.21 KiB) Viewed 4676 times
Image
SMUSEBY
Posts: 638
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Device state - not working

Post by SMUSEBY »

This sounds like what I need. However, I can't find the window over Device Details. (the attached shows where I'm looking).
Attachments
2019-10-06_1302.png
2019-10-06_1302.png (176.84 KiB) Viewed 4660 times
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Device state - not working

Post by matt (support) »

Click-drag on the thumbnail grabby thingie (the small gray circle) that is directly above the "left .53" and drag up – it will expose the device states view.
Image
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Device state - not working

Post by FlyingDiver »

You need to drag up on the "dimple". See the image.

But in this case, you don't need to see what's in there. This is a standard on/off device. As I stated above, the name of the state is 'onOffState'.
Attachments
2019-10-06_1302.png
2019-10-06_1302.png (179.09 KiB) Viewed 4656 times
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
SMUSEBY
Posts: 638
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Device state - not working

Post by SMUSEBY »

Wow!
My peeling of the Indigo onion continues.
SMUSEBY
Posts: 638
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Device state - not working

Post by SMUSEBY »

small bug: in the Device Details window, onOffState is written as On State (which I just discovered, does not work).
Post Reply

Return to “Better Email”