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

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

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

to answer my question:
Screen Shot 2018-10-12 at 13.34.51.png
Screen Shot 2018-10-12 at 13.34.51.png (6.92 KiB) Viewed 2820 times
yes it does
Code: Select all
                     keyValueList = []
                     keyValueList.append({'key':'onOffState', 'value':not dev.onState,"uiValue":"text abc"})
                     dev.updateStatesOnServer(keyValueList)
                     dev.updateStateImageOnServer(indigo.kStateImageSel.Auto)

Karl

Posted on
Fri Oct 12, 2018 1:02 pm
kw123 offline
User avatar
Posts: 8365
Joined: May 12, 2013
Location: Dallas, TX

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

but still the question how to change the devicetype not the devicetypeID in the plugin ( re-read the devices.xml file and force update from <Device type="custom" .... to <Device type="sensor" ...)

when I just change <Device type="custom" .... to <Device type="sensor" and reload the plugin the device does not read this and continues the old "custom".

Tried
"dev.replaceOnServer()"
does not do its.

Karl

Posted on
Fri Oct 12, 2018 3:18 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

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

Take look at this post. I'm not positive that API will work in this case, but give it a try.

Image

Posted on
Fri Oct 12, 2018 3:40 pm
kw123 offline
User avatar
Posts: 8365
Joined: May 12, 2013
Location: Dallas, TX

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

Thx.


Sent from my iPhone using Tapatalk

Posted on
Fri Oct 12, 2018 5:45 pm
kw123 offline
User avatar
Posts: 8365
Joined: May 12, 2013
Location: Dallas, TX

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

This works in
Code: Select all
      def deviceStartComm(self,dev):
         if self.pluginState == "init":
            dev.stateListOrDisplayStateIdChanged()   # update  from device.xml info if changed
            if self.version < 32.50:
               if dev.deviceTypeId in ["Wire18B20","DHTxx","DHT11","i2cTMP102","i2cMCP9808","i2cLM35A","i2cT5403","i2cMS5803","i2cBMPxx","tmp006","i2cSHT21""i2cAM2320","i2cBMExx","bme680","si7021"]:
                  props = dev.pluginProps
                  if "SupportsSensorValue" not in props:
                     dev = indigo.device.changeDeviceTypeId(dev, dev.deviceTypeId)
                     dev.replaceOnServer()
                     dev = indigo.devices[dev.id]
                     props = dev.pluginProps
                     props["SupportsSensorValue"]       = True
                     props["SupportsOnState"]          = False
                     props["AllowSensorValueChange"]    = False
                     props["AllowOnStateChange"]       = False
                     props["SupportsStatusRequest"]       = False
                     dev.replacePluginPropsOnServer(props)


this reloads the newly defined device definitions from the xml file ie the deviceType and sets the proper sensorVales settings

thanks so much .. this make everything a lot easier !!

Karl

still have to go through the onOff devices and some fine tuning..

a little closer to indigo standard

Posted on
Sat Oct 13, 2018 1:05 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

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

Great – I'm glad it is working (it was untested I believe in this scenario)! Thanks for the follow-up.

Image

Posted on
Wed Oct 17, 2018 9:47 pm
kw123 offline
User avatar
Posts: 8365
Joined: May 12, 2013
Location: Dallas, TX

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

question:

on page: https://wiki.indigodomo.com/doku.php?id=indigo_7_documentation:device_class
it has "allowSensorValueChange" as device class property

while in the sensor example the property is:
Code: Select all
         <Field id="AllowSensorValueChange" type="checkbox" hidden="true" defaultValue="false">
            <Label>Enable controls to override sensor value state</Label>
with a capital A -- which seems to work setting it to True/ False

AllowSensorValueChange vs allowSensorValueChange.
same for AllowOnStateChange etc.

are these different props, spelling error .. ?

Karl

Posted on
Thu Oct 18, 2018 9:52 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

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

They are the same properties. All device instance properties start with lowercase (so dev.allowSensorValueChange), but when overriding those via a pluginProps dict we use "AllowSensorValueChange". Internally they are different things – some special pluginProps automatically get propagated down into an instance level property when they are changed which is what is happening here: internally when changing pluginProps["AllowSensorValueChange"] the Indigo Server pushes the change down into dev.allowSensorValueChange. I totally agree this is confusing and the underlying plumbing doesn't justify the inconsistency, but it explains why it works (because they are "special" properties that can be overwritten by a plugin that owns them). In this case the standard for capitalizing pluginProps[] entries came about independently of instance level dev.someProps and we are trying to be consistent within the scope of each.

Image

Posted on
Thu Oct 18, 2018 4:21 pm
kw123 offline
User avatar
Posts: 8365
Joined: May 12, 2013
Location: Dallas, TX

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

got it .. thanks..

now how can we use allowSensorValueChange

setting SupportsStatusRequest = True shows a button "send Status Request". Thats nice I can use that one

allowSensorValueChange =True does not add any buttons.
Is it for binary devices ie to enable "indigo.sensor.setOnState(123, value=True)"

Would be nice If we could add a "reset button" to an "analog" sensor device eg counter devices eg rain sensor (almost analog) similar to reset accumulated energy *)

Karl
*) that should actually be Energy don't know what accumulated Energy is; E= integral(power dt), accumulated Energy would be Integral(Integral(power dt) dt. with power = potential * current (V*A).. if i remember physics correctly

Posted on
Fri Oct 19, 2018 11:58 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

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

allowOnStateChange has Indigo show/allow UI and actions for turning on/off binary sensor values, which is useful for example if there is a module that sends out an alert/tripped message (causing an ON state in Indigo) but never sends out a clear/off message (thus requiring the user to manually turn off the sensor state in Indigo).

allowSensorValueChange currently doesn't do anything :roll: but once implemented will be useful for scenarios like you describe above.

Image

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

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

It seems that onOff devices do NOT show the UI state but the binary value in iTouch (on/off).
It shows correctly in the state column in the client

Analog sensor show the UI value in iTouch

Is that by design?

Karl

Posted on
Fri Oct 26, 2018 11:30 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

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

Can you screen capture an example for me?

Image

Posted on
Sat Oct 27, 2018 5:25 am
kw123 offline
User avatar
Posts: 8365
Joined: May 12, 2013
Location: Dallas, TX

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

there the 2 screen shots:
Attachments
Screen Shot 2018-10-27 at 06.24.08.png
Screen Shot 2018-10-27 at 06.24.08.png (20.6 KiB) Viewed 2538 times
Screen Shot 2018-10-27 at 06.21.27.png
Screen Shot 2018-10-27 at 06.21.27.png (25.48 KiB) Viewed 2538 times

Posted on
Sat Oct 27, 2018 12:57 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

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

Thanks, I understand now. Added to my Indigo Touch todo list.

Image

Who is online

Users browsing this forum: No registered users and 6 guests

cron