evilpete / ISYlib-python

Simple Python lib for the ISY home automation controller
BSD 2-Clause "Simplified" License
27 stars 19 forks source link

Handle ISY version 5+ firmware events. #15

Closed bpaauwe closed 8 years ago

bpaauwe commented 8 years ago

ISY version 5+ firmware adds some additional information to the events that are sent through the subscripton channel. Specifically the tag now includes attributes that specify the unit of measure and precision of the action value.

Prior to version 5, the action tag would look like:

<action>255</action>

Version 5+ firmware will now send:

<action uom="100" prec="0">255</action>

The et2d function is not able to parse this change and results in setting the action key in the dictionary to the attribute list instead of the value.

This change makes all the dictionary tag name keys get the value or value list and restricts the attributes to tag_name-attribute_name keys.

evilpete commented 8 years ago

The formatting looks off, can send me sample XML for me to validate ? ( else I plan to up my firmware with in the next week to so )

bpaauwe commented 8 years ago

Here's the raw XML from my ISY (version 5.0.1 firmware). I keep forgetting that these comment boxes munge up the XML.

<Event seqnum="242" sid="uuid:171">
 <control>ST</control>
 <action uom="100" prec="0">255</action>
 <node>5 78 97 1</node>
 <eventInfo></eventInfo>
 <fmtAct>100%</fmtAct>
</Event>
<Event seqnum="243" sid="uuid:171">
 <control>ST</control>
 <action uom="100" prec="0">255</action>
 <node>14 9F EB 1</node>
 <eventInfo></eventInfo>
 <fmtAct>100%</fmtAct>
</Event>
<nodeInfo>
evilpete commented 8 years ago

I will have to examine this closer, your patch is not compatible with regard to parsing node properties

see node obj XML from http://ISY-ADDR/rest/nodes

</nodeInfo>
<node flag="128">
 <address>16 3F E5 1</address>
 <name>Garage_Light</name>
 <type>1.25.56.0</type>
 <enabled>true</enabled>
 <deviceClass>0</deviceClass>
 <wattage>60</wattage>
 <dcPeriod>0</dcPeriod>
 <pnode>16 3F E5 1</pnode>
 <ELK_ID>A02</ELK_ID>
 <property id="ST" value="255" formatted="On" uom="%/on/off"/>
</node>

and http://ISY-ADDR/rest/nodes/NODE-ADDR

<nodeInfo>
 <node flag="128">
  <address>16 3F E5 1</address>
  <name>Garage_Light</name>
  <type>1.25.56.0</type>
  <enabled>true</enabled>
  <deviceClass>0</deviceClass>
  <wattage>60</wattage>
  <dcPeriod>0</dcPeriod>
  <pnode>16 3F E5 1</pnode>
  <ELK_ID>A02</ELK_ID>
  <property id="ST" value="255" formatted="On" uom="%/on/off"/>
 </node>
 <properties>
  <property id="OL" value="191" formatted="75" uom="%/on/off"/>
  <property id="RR" value="26" formatted="4.5 " uom="seconds"/>
  <property id="ST" value="255" formatted="On" uom="%/on/off"/>
 </properties>
</nodeInfo>
evilpete commented 8 years ago

added a work around to et2d, supporting code may still need updating. evilpete@afe7817