prop.onState <-> dev.states["onoffState"] <-> dev.onState

Posted on
Thu Oct 11, 2018 3:42 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

prop.onState <-> dev.states["onoffState"] <-> dev.onState

I have a custom device with a state: onoffState
dev.onState gives an error https://wiki.indigodomo.com/doku.php?id=indigo_7_documentation:device_class#device_base_class shows it is available for indigo predefined devices

Is this state mapping to dev.onState only available for predefined indigo device type (relay ...) or also for custom device states? and if so what is missing?

Karl
Attachments
Screen Shot 2018-10-11 at 16.12.11.png
Screen Shot 2018-10-11 at 16.12.11.png (125.57 KiB) Viewed 3065 times

Posted on
Thu Oct 11, 2018 4:15 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

Post the relevant part of the Devices.xml?

I think you have to define the device as a sensor type to get the automatic on/off functionality.

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

Posted on
Thu Oct 11, 2018 4:24 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

understand the sensor type dev has onoffState but if it is not a sensor type !! -- I have 50 different sensor types and have put the types into the device type id

Code: Select all
      <Device type="custom" id="INPUTtouch-1">  ...   INPUT-GPIO .. INPUT-Temperature INPUT-xxx etc
....
      <State id="onoffState">
               <ValueType>boolean</ValueType>
               <TriggerLabel>onoffState</TriggerLabel>
            <ControlPageLabel>onoffState</ControlPageLabel>
         </State>

Posted on
Thu Oct 11, 2018 4:25 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

kw123 wrote:
understand the sensor type dev has onoffState but if it tis not a sensor type !! -- I have 50 different sensor types and have put the types into the device type id

Code: Select all
      <Device type="custom" id="INPUTtouch-1">  ...   INPUT-GPIO .. INPUT-Temperature INPUT-xxx etc
....
      <State id="onoffState">
               <ValueType>boolean</ValueType>
               <TriggerLabel>onoffState</TriggerLabel>
            <ControlPageLabel>onoffState</ControlPageLabel>
         </State>


Sure looks like a sensor to me. You don't loose anything by starting your device definition with sensor instead of custom. Custom is for devices that don't have any of the attributes of the standard devices.

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

Posted on
Thu Oct 11, 2018 4:44 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

I have > 50 different devices types defined. and all the logic uses devicetypeid to id the different devices .. every device has its specialties.
temp, temp+hum, temp+hum+press, on/off/, distance, speed, resistor measurement, ADC value, range 0-255, 0-1024, 0-4096, rain amounts ... etc etc , update frequency, last value, min/max today yesterday .... light uva, uvb, red, green blue ir ..

many of these sensors have > 20 states defined

if i change that, all devices have to be deleted and recreated, changing a devices type for an existing devices does not work properly with existing props etc and you need to have old and new devtypeid defined, otherwise indigo can not handle any of the plugin devices selections anymore ...(if an existing devitypid is not defined it shows empty devtypes for all devices -- tried that before)
...

I really don't want to do that

Karl

Posted on
Thu Oct 11, 2018 4:44 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

FlyingDiver wrote:
Sure looks like a sensor to me. You don't loose anything by starting your device definition with sensor instead of custom. Custom is for devices that don't have any of the attributes of the standard devices.


+1. Your screen shot is of the DimmerDevice properties. If you look at the Device Base class (upon which all custom devices inherit), there is no onState.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Oct 11, 2018 4:48 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

kw123 wrote:
if i change that, all devices have to be deleted and recreated, changing a devices type for an existing devices does not work properly with existing props etc and you need to have old and new devtypeid defined, otherwise indigo can not handle any of the plugin devices selections anymore ...(if an existing devitypid is not defined it shows empty devtypes for all devices -- tried that before)l


Not quite sure I'm following any of that - you can define your own Sensor device and add as many custom states to it as you like.

You are right, however, that for your existing custom devices you'd have to convert them all, probably in the deviceStartComm method, to the new device type if you changed them. It would be a big undertaking and it may not even be fully automated (i've never actually tried).

Is there some reason you want the onState property (vs just the "onOffState" state you've already added)?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Oct 11, 2018 4:54 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

Onstate is used by eg home bridge to select devices
And if dev.onState is not present the device is ignored.

I was hoping to by adding dev state onoffState indigo would also make dev.onstate available.



Sent from my iPhone using Tapatalk

Posted on
Thu Oct 11, 2018 5:02 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

You might beg C4W to look for an "onOffState" in the device's states as well - might not be a huge code change for him.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Oct 11, 2018 5:09 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

Also if there are 50plus different device types how would I make them all the same device type id and distinguish them?

Can I use multiple devicetypeid = Sensor and different device models ( the text that is shown) ?




Sent from my iPhone using Tapatalk

Posted on
Thu Oct 11, 2018 5:11 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

kw123 wrote:
Also if there are 50plus different device types how would I make them all the same device type id and distinguish them?

Can I use multiple devicetypeid = Sensor and different device models ( the text that is shown) ?


You would have 50 different deviceTypeIds, but each would be of type "sensor" rather than "custom"...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Oct 11, 2018 5:18 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

.. oops i got confused with device type and devicetypeID

Posted on
Thu Oct 11, 2018 5:20 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

jay (support) wrote:
kw123 wrote:
Also if there are 50plus different device types how would I make them all the same device type id and distinguish them?

Can I use multiple devicetypeid = Sensor and different device models ( the text that is shown) ?


You would have 50 different deviceTypeIds, but each would be of type "sensor" rather than "custom"...


And - if a physical device has different "personalities" like temp & humidity, then you could create a group of devices, one for each "personality". That's how Z-Wave multi-sensors work. The master device is generally the motion part, but the other functions are presented as their own sensor device in Indigo.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Oct 11, 2018 9:48 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

have converted one custom device type to sensor with temperature.

here the next question:
to convert had to open the device, change device type to something else and back to the devicetypid, then all was set.

how would I do this in the plugin?

can I force to re-read the device XML for the props . I know how to re-read the states and update add/ delete .. state defs

Karl

Posted on
Fri Oct 12, 2018 9:36 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: prop.onState <-> dev.states["onoffState"] <-> dev.onStat

and one more, before I create a mess with my devices..

from the plugin sdk:
Code: Select all
                        keyValueList.append({'key':'onOffState', 'value':not dev.onState})
                        dev.updateStatesOnServer(keyValueList)

does it accept "uiValue"="text for status" for on/off sensor devices for states update? or its it fixed predefined: on / off

thx

Karl

Who is online

Users browsing this forum: No registered users and 20 guests

cron