Skip to content

Commit

Permalink
#18 Clean up sensor capabilty support and add humidity if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimboca committed Dec 28, 2018
1 parent 93af903 commit ab94e27
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
27 changes: 18 additions & 9 deletions node_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,16 +593,25 @@ def start(self):
def update(self, sensor):
LOGGER.debug("{}:update:".format(self.address))
LOGGER.debug("{}:update: sensor={}".format(self.address,sensor))
try:
tempCurrent = int(sensor['capability'][0]['value']) / 10 if int(sensor['capability'][0]['value']) != 0 else 0
except ValueError as e:
tempCurrent = 0
if self.useCelsius:
tempCurrent = toC(tempCurrent)
updates = {
'ST': tempCurrent,
'GV1': 1 if sensor['capability'][1]['value'] == "true" else 0
self.updates = {
'GV1': 2 # Default is N/A
}
# Cross reference from sensor capabilty to driver
xref = {
'temperature': 'ST',
'humidity': 'CLIHUM',
'occupancy': 'GV1',
}
for item in sensor['capability']:
if item['type'] in xref:
val = item['value']
if val == "true":
val = 1
elif val == "false":
val = 0
self.updates[xref[item['type']]] = val
else:
LOGGER.error("{}:update: Unknown capabilty: {}".format(self.address,item))
for key, value in updates.items():
self.setDriver(key, value)

Expand Down
2 changes: 1 addition & 1 deletion profile/editor/editors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<range uom="67" subset="0-3" />
</editor>
<editor id="I_TSTAT_OCC">
<range uom="25" subset="0,1" nls="EN_BOOL" />
<range uom="25" subset="0-2" nls="EN_OCC" />
</editor>
<editor id="I_TSTAT_PROG_MODE">
<range uom="25" subset="0,1" nls="EN_PM" />
Expand Down
4 changes: 4 additions & 0 deletions profile/nls/en_us.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ EN_PM2-2 = Hold Indefinite
EN_BOOL-0 = No
EN_BOOL-1 = Yes

EN_OCC-0 = No
EN_OCC-1 = Yes
EN_OCC-2 = NA

EN_ENABLED-0 = Disabled
EN_ENABLED-1 = Enabled

Expand Down
2 changes: 2 additions & 0 deletions profile/nodedef/nodedefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,14 @@
<nodeDef id="EcobeeSensorC" nodeType="140" nls="140ES" >
<sts>
<st id="ST" editor="I_TEMP_C" />
<st id="CLIHUM" editor="I_HUMIDITY" />
<st id="GV1" editor="I_TSTAT_OCC" />
</sts>
</nodeDef>
<nodeDef id="EcobeeSensorF" nodeType="140" nls="140ES" >
<sts>
<st id="ST" editor="I_TEMP_F" />
<st id="CLIHUM" editor="I_HUMIDITY" />
<st id="GV1" editor="I_TSTAT_OCC" />
</sts>
</nodeDef>
Expand Down
2 changes: 1 addition & 1 deletion profile/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.7
2.0.14

0 comments on commit ab94e27

Please sign in to comment.