Insteon Thermostat 2441TH for ISY

@shbatm fwiw, here’s the stack trace I’m getting:

  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
    await entity.async_update_ha_state()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 256, in _async_write_ha_state
    attr.update(self.device_state_attributes or {})
  File "/home/homeassistant/.homeassistant/custom_components/isy994/__init__.py", line 484, in device_state_attributes
    for name, val in self._node.aux_properties.items():
AttributeError: 'list' object has no attribute 'items'

EDIT: here’s what the _node.aux_properties contains:

[{'id': 'CLIMD', 'value': 1, 'uom': ['67'], 'prec': '0'}, 
{'id': 'CLISPC', 'value': 77, 'uom': ['17'], 'prec': '0'}, 
{'id': 'CLISPH', 'value': 70, 'uom': ['17'], 'prec': '0'}]

@jon102034050 – I don’t have a Z-Wave T-Stat to test with so thanks for helping and reporting the issue.

A couple things to try:

  1. Make sure you’re using the latest version from this branch: https://github.com/shbatm/home-assistant/blob/isy994-climate-dev/homeassistant/components/isy994 – I had a similar error show up in one version that I was trying to get through review. Hass tries to get the aux_properties from the wrong place (__init__.py instead of climate.py).

  2. Please enable debug logging for this component in your config and share the logs back (here, or create an issue at my branch in GitHub to track).

logger:
  default: info
  logs:
    custom_components.isy994: debug

Hm, I’m pretty sure I pulled the custom component files from your latest release, but I’ll double check this. I’ve enabled debug logs and created an issue for you - thanks!
https://github.com/shbatm/home-assistant/issues/1

edit: confirmed I cloned out of the correct branch, all files md5 the same.

I just followed the above steps with hassio and am getting an error in the logs and no climate device showing up in the UI. I am using an ISY994i with a Venstar T1800.

2019-06-06 13:55:00 ERROR (MainThread) [homeassistant.core] Error doing job: Tas
k exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 3
65, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 225, in as
ync_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 255, in _a
sync_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", li
ne 211, in state_attributes
    self.precision),
  File "/usr/src/homeassistant/homeassistant/helpers/temperature.py", line 22, i
n display_temp
    "Temperature is not a number: {}".format(temperature))
TypeError: Temperature is not a number: None

@sjthespian – Can you please enable debugging and post the logs somewhere (pastebin, here, or my Github fork) so I can try and diagnose?

@jon102034050 – I haven’t forgotten about you, sorry, I’ve been a little busy (work, wedding, etc…).

1 Like

@sjthespian Please try changing the last line of isy994/climate.py from the following:

from:

return temp

EDITED:
to

return round(float(temp), 1)

or:

return round(int(temp) / 10, 1)

I’m not sure what the precision is. If you can, please post the results of http://your.isy.ip/rest/nodes/NODEID so I can see if it provides the precision or if I have to guess.

@jon102034050 It looks like your error is being caused by the following issue:

I’ve added the proposed pull request from @OverloadUT to my test branch of PyISY to see if it solves the problem.

Please try downloading the latest update and restart. If setup as a custom component, it should force an installation of the PyISY_beta v1.1.5 package.

1 Like

sweet, will give this a try when I’m back in town. thanks!

Forcing it to a float doesn’t seem to help, it looks like it’s trying to return None:

2019-06-10 07:50:08 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 255, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 210, in state_attributes
    self.hass, self.current_temperature, self.temperature_unit,
  File "/config/custom_components/isy994/climate.py", line 231, in current_temperature
    return self.value
  File "/config/custom_components/isy994/climate.py", line 204, in value
    return self.fix_temp(self._node.status)
  File "/config/custom_components/isy994/climate.py", line 340, in fix_temp
    return round(float(temp), 1)
  File "/usr/local/lib/python3.7/site-packages/VarEvents/__init__.py", line 223, in __float__
    return float(self._val)
TypeError: float() argument must be a string or a number, not 'NoneType'

Here is what I get from the node list:

<node flag="128" nodeDefId="Thermostat">
  <address>14 14 F0 1</address>
  <name>Thermostat</name>
  <type>5.3.149.0</type>
  <enabled>true</enabled>
  <deviceClass>1</deviceClass>
  <wattage>1000</wattage>
  <dcPeriod>60</dcPeriod>
  <startDelay>0</startDelay>
  <endDelay>0</endDelay>
  <pnode>14 14 F0 1</pnode>
  <property id="ST" value="152" formatted="76.0°" uom="101"/>
  <property id="CLIMD" value="7" formatted="Program Cool" uom="98"/>
  <property id="CLISPC" value="150" formatted="75.0°" uom="101"/>
  <property id="CLISPH" value="136" formatted="68.0°" uom="101"/>
  <property id="CLIHUM" value="41" formatted="41%" uom="22"/>
</node>

I will give debug mode a try after I come out of my Monday morning meeting marathon…

I just grabbed the latest code from github and enabled debug – interestingly enough, it looks like it isn’t the thermostat that is causing the problem! It’s one of my ZWave devices…

2019-06-10 10:19:54 DEBUG (MainThread) [custom_components.isy994.climate] Adding ISY node Node(ZW003_144) to Climate platform
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 210, in state_attributes
  File "/config/custom_components/isy994/climate.py", line 231, in current_temperature
  File "/config/custom_components/isy994/climate.py", line 204, in value
  File "/config/custom_components/isy994/climate.py", line 340, in fix_temp
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 210, in state_attributes
  File "/config/custom_components/isy994/climate.py", line 231, in current_temperature
  File "/config/custom_components/isy994/climate.py", line 204, in value
  File "/config/custom_components/isy994/climate.py", line 340, in fix_temp
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 210, in state_attributes
  File "/config/custom_components/isy994/climate.py", line 231, in current_temperature
  File "/config/custom_components/isy994/climate.py", line 204, in value
  File "/config/custom_components/isy994/climate.py", line 340, in fix_temp

I am not sure why it is picking that up as a climate device:

<node flag="0" nodeDefId="UZW00C0">
  <address>ZW003_144</address>
  <name>ZW 003 Pulse Meter</name>
  <family>4</family>
  <type>4.33.1.0</type>
  <enabled>true</enabled>
  <deviceClass>0</deviceClass>
  <wattage>0</wattage>
  <dcPeriod>0</dcPeriod>
  <startDelay>0</startDelay>
  <endDelay>0</endDelay>
  <pnode>ZW003_1</pnode>
  <sgid>144</sgid>
  <devtype>
    <gen>4.33.1</gen>
    <mfg>134.258.100</mfg>
    <cat>144</cat>
  </devtype>
</node>

From a quick look at the logs, it looks like it is trying to add all of my ZWave devices, even though they aren’t Climate devices.

In isy994/__init__.py, search for 4.33 and remove it under the climate section.

EDIT: More precisely, find this line and replace 4.33.1. with 5.3.149.

Great! That gets me a lot closer…

2019-06-10 11:09:06 DEBUG (MainThread) [custom_components.isy994.climate] Adding ISY node Node(14 14 F0 1) to Climate platform
2019-06-10 11:09:06 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new climate.isy994 entity: climate.thermostat

But, there are still no climate entities showing up in the UI:

Entity not available: climate.thermostat

and there are no climate entities in the developer tools.

And I found this further down in the logs:

2019-06-10 11:09:07 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 363, in _async_add_entity
    await entity.async_added_to_hass()
  File "/config/custom_components/isy994/climate.py", line 130, in async_added_to_hass
    if i['id'] == ISY_CURRENT_HUMIDITY), False)
  File "/config/custom_components/isy994/climate.py", line 130, in <genexpr>
    if i['id'] == ISY_CURRENT_HUMIDITY), False)
TypeError: string indices must be integers

Ok. I get home from a business trip tomorrow… I’ll troubleshoot some more when I get back.

I think I see the problem. The code at line 129 (and in the following 3 blocks) is iterating over this dict:

{'CLIMD':
  {'id': 'CLIMD', 'value': 7, 'prec': '0', 'uom': ['98']},
 'CLISPC':
  {'id': 'CLISPC', 'value': 156, 'prec': '0', 'uom': ['101']},
 'CLISPH':
  {'id': 'CLISPH', 'value': 124, 'prec': '0', 'uom': ['101']},
 'CLIHUM':
  {'id': 'CLIHUM', 'value': 41, 'prec': '0', 'uom': ['22']}}

However, the for loop just looks at the key, not the value. I just changed the four loops to loop with values() instead and I am now getting climate data.

Here is the diff:

diff --git a/homeassistant/components/isy994/climate.py b/homeassistant/components/isy994/climate.py
index edbadae..7ac33fe 100644
--- a/homeassistant/components/isy994/climate.py
+++ b/homeassistant/components/isy994/climate.py
@@ -126,22 +126,22 @@ class ISYThermostatDevice(ISYDevice, ClimateDevice):

     async def async_added_to_hass(self):
         """Delayed completion of initialization."""
-        current_humidity = next((i for i in self._node.aux_properties
+        current_humidity = next((i for i in self._node.aux_properties.values()
                                  if i['id'] == ISY_CURRENT_HUMIDITY), False)
         if current_humidity:
             self._current_humidity = current_humidity['value']

-        target_temp_high = next((i for i in self._node.aux_properties
+        target_temp_high = next((i for i in self._node.aux_properties.values()
                                  if i['id'] == ISY_TARGET_TEMP_HIGH), False)
         if target_temp_high:
             self._target_temp_high = self.fix_temp(target_temp_high['value'])

-        target_temp_low = next((i for i in self._node.aux_properties
+        target_temp_low = next((i for i in self._node.aux_properties.values()
                                 if i['id'] == ISY_TARGET_TEMP_LOW), False)
         if target_temp_low:
             self._target_temp_low = self.fix_temp(target_temp_low['value'])

-        current_operation = next((i for i in self._node.aux_properties
+        current_operation = next((i for i in self._node.aux_properties.values()
                                   if i['id'] == ISY_OPERATION_MODE), False)
         if current_operation:
             self._current_isy_operation = VALUE_TO_ISY_MODE.get(
1 Like

Thanks for the update. I’m not sure why it was working on my instance and not yours. I added the changes and pushed a new version to GitHub.

Works great! Just installed without issue. Running ISY 5.0.14 and latest Hass.io on RPi3.

As per the instructions @shbatm posted on March 26th, I just got this working on my Hassio instance, as well. Super simple, but for the less adventurous folks, here’s a bit more detail: I ssh’d into my instance (enable the ssh add-on, first, of course), created a temporary directory into which I cloned the repo, did git checkout isy994-climate-dev to get files in the branch, then copied the contents of the isy994 directory from the repo into /config/custom_components/isy994/. Finally, reboot the Hassio RPi and…viola! My Insteon thermostats show up as entities I can play with in HA now. Super stoked! Thanks for working on this @shbatm! :smile: :beers:

I just installed the custom component but the temp is wrong. First I thought it was Celsius, but its not. Any idea?

Figured it out. I downloaded the dev branch.

All,

I just pushed another round of updates to the isy994-climate-dev branch–this is for compatibility with the new climate-1.0 framework in Home Assistant version > 0.96.0b0.

I also had to clean-up my code and branches, getting ready for some PRs. isy994-climate-dev now includes the general cleanup and Z-wave expansion in isy994-zwave-x. Use isy994-climate-dev if you want ALL of the changes I have been working on.

1 Like