Home Assistant plugin updated for Python 3

User avatar
roquej
Posts: 628
Joined: Sun Jan 04, 2015 4:56 pm
Location: South Florida, USA

Re: Home Assistant plugin updated for Python 3

Post by roquej »

There was a reason I was not using the Trane Plugin. Let me give you the use case:

1. you go on vacation and want to set the temp to, let's say, 78-79 degrees and put the thermostat on hold (deactivate the schedule)
2. you return from vacation and want to reactivate the thermostat schedule.

#1 works with no issues, but #2 doesn't.

I opened issues in GitHub.

JP
User avatar
roquej
Posts: 628
Joined: Sun Jan 04, 2015 4:56 pm
Location: South Florida, USA

Re: Home Assistant plugin updated for Python 3

Post by roquej »

Sorry, but I couldn't find a way to open an issue for this repository in GitHub.

Have a climate device for the pool heater—just a heater with one temp sensor. When trying to control the temp, getting this error:

Code: Select all

  Home Assistant Error            Error in plugin execution ExecuteAction:

  File "plugin.py", line 242, in actionControlThermostat
  File "plugin.py", line 273, in _handleChangeSetpointAction
type: 'method' object is not subscriptable
JP
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Home Assistant plugin updated for Python 3

Post by FlyingDiver »

https://github.com/FlyingDiver/IndigoHA ... g/2022.0.1

If you still get errors, make sure debug logging is on.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
User avatar
roquej
Posts: 628
Joined: Sun Jan 04, 2015 4:56 pm
Location: South Florida, USA

Re: Home Assistant plugin updated for Python 3

Post by roquej »

No luck. All the other switches work (pump, cleaner, fill_line, drain_line, waterfall) well, EXCEPT the switch to the heater or anything for the climate entity:

From Indigo log:

Code: Select all

  Home Assistant Debug            logLevel = 10
   Home Assistant Debug            Device content:
{'entity_id': 'climate.pool', 'state': 'off', 'attributes': {'hvac_modes': ['heat', 'off'], 'min_temp': 32, 'max_temp': 104, 'current_temperature': 87, 'temperature': 55, 'friendly_name': 'Pool', 'supported_features': 1}, 'last_changed': '2023-07-29T06:08:18.482069+00:00', 'last_updated': '2023-07-30T13:02:55.597589+00:00', 'context': {'id': '01H6KEA2KD8QYJEY5PV2ABYPPY', 'parent_id': None, 'user_id': None}}
   Home Assistant Error            Error in plugin execution ExecuteAction:

  File "plugin.py", line 247, in actionControlThermostat
  File "plugin.py", line 289, in _handleChangeSetpointAction
type: name 'action' is not defined


Jul 30, 2023 at 10:01:25 AM
   Home Assistant Debug            sent "Pool HA 04-Heater (HA Plugin)" on
   Error                           device "Pool HA Thermostat (ERROR)" state key hvacHeaterIsOn not defined (ignoring update request)
   Error                           device "Pool HA Thermostat (ERROR)" state key hvacHeaterIsOn not defined (ignoring update request)
   Home Assistant Error            Error in plugin execution runConcurrentThread:

  File "plugin.py", line 113, in runConcurrentThread
type: 'operation_mode'

   Home Assistant Error            plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
   Error                           device "Pool HA Thermostat (ERROR)" state key hvacHeaterIsOn not defined (ignoring update request)
   Error                           device "Pool HA Thermostat (ERROR)" state key hvacHeaterIsOn not defined (ignoring update request)
   Home Assistant Error            Error in plugin execution runConcurrentThread:

  File "plugin.py", line 113, in runConcurrentThread
type: 'operation_mode'

   Home Assistant Error            plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
   Home Assistant Debug            sent "Pool HA 04-Heater (HA Plugin)" off
   Error                           device "Pool HA Thermostat (ERROR)" state key hvacHeaterIsOn not defined (ignoring update request)
   Error                           device "Pool HA Thermostat (ERROR)" state key hvacHeaterIsOn not defined (ignoring update request)
   Home Assistant Error            Error in plugin execution runConcurrentThread:

  File "plugin.py", line 113, in runConcurrentThread
type: 'operation_mode'

   Home Assistant Error            plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Home Assistant plugin updated for Python 3

Post by FlyingDiver »

I'm working on getting issues enabled for the HA plugin. I'll let you know when they are so you can add this there.

Right now I'm working on the Trane Home plugin updates.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Home Assistant plugin updated for Python 3

Post by FlyingDiver »

I've just completed (enough for testing anyway) a major rewrite of the Home Assistant plugin. Among other changes, it's now named "Home Assistant Agent".

Pre-release here; https://github.com/FlyingDiver/Indigo-H ... g/2023.0.0

GitHub issues are enabled. Ask questions or report errors here, but post the details in a GitHub issue. Make sure you have debug logging enabled when posting log sections.

Notable changes:

Plugin uses zeroconf to find local Home Assistant servers. You'll still need a token, but you don't need to input ip address or port.

Plugin maintains a list of all the entities that HA knows, so when you create an Indigo device, you can just select from a pop-up.

State column in Indigo UI shows appropriate units and images for the devices. Or should, anyway. Please report anomalies.

Climate devices should handle cool modes as well as heat, but that is not well tested yet.

Under the hood, the plugin no longer polls the HA server for updates. It uses the WebSocket API to get updates immediately, so response times are VERY quick.

If you enable the system monitoring entities in HA, you can monitor the cpu/disk/network of your HA server. Very handy.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
farberm
Posts: 393
Joined: Sun Feb 24, 2008 2:14 pm

Re: Home Assistant plugin updated for Python 3

Post by farberm »

Thanks for the update. I tired to install entities but I get none in the list under edit device settings (same for climate, switch and sensor). I tried with both no IP address and port and token and with IP address and port and token. It is using the same token as the prior versions go the plugin....

Code: Select all

Aug 2, 2023 at 7:56:13 PM
   Home Assistant Agent Error      Error in plugin execution GetUiDynamicList:

  File "plugin.py", line 158, in get_entity_list
type: ('light',)

   Home Assistant Agent            new device 7: Starting device with address: 
   Home Assistant Agent Error      Error in plugin execution ServerReplacedElem:

  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/plugin_base.py", line 1379, in device_updated
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/plugin_base.py", line 1315, in _dispatch_device_start_comm
  File "plugin.py", line 129, in deviceStartComm
type: list index out of range

User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Home Assistant plugin updated for Python 3

Post by FlyingDiver »

Turn on debug logging, restart the plugin, then repost. You should probably try to create a new device to see if that works, even if there's an error editing an old device.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
farberm
Posts: 393
Joined: Sun Feb 24, 2008 2:14 pm

Re: Home Assistant plugin updated for Python 3

Post by farberm »

I did not debugging on and I was trying to create a new HA Agent-Model. I tired Climate, Light, Switch. Binary Sensor and Value Sensor. They all had no values in the dropdown menu when I select Edit device Settings. Here is the debug code. The first set of devices listed are from the prior version of the plugin. (All Pentair Value Sensors and a few lights). It finds my HA server but Error when getting the list.

Let me know what additional info you need. Happy to help.

Code: Select all

Aug 2, 2023 at 8:12:17 PM
   Home Assistant Agent Debug      found_server_list: filter = , typeId = 0, targetId = 0, valuesDict = UiValuesDict : (dict)
     HADebugInfo : false (bool)
     address : 192.168.2.60 (string)
     found_list : Home._home-assistant._tcp.local. (string)
     haToken : eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIxZWQ5NWUwNzkwYTI0ZDZmYjgyMGE0YzBlMzhjNTUwMiIsImlhdCI6MTYxNDQ2NTU4OCwiZXhwIjoxOTI5ODI1NTg4fQ.77eSGINj7t2sI8cVQ5ccaVPJ1CbcgeP9KomEf6Oyi1U (string)
     logLevel : 5 (string)
     pollingInt : 300 (string)
     port : 8123 (string)
     serverAddress : 192.168.2.60 (string)
     serverPort : 8123 (string)
   Home Assistant Agent Debug      found_station_list: retList = [('Home._home-assistant._tcp.local.', 'Home._home-assistant._tcp.local. (192.168.2.60:8123)')]


   Starting plugin "Home Assistant Agent 2023.0.0" (pid 53745)
   Home Assistant Agent Debug      logLevel = 5
   Started plugin "Home Assistant Agent 2023.0.0"
   Home Assistant Agent Debug      startup called
   Home Assistant Agent Debug      Connecting to 'ws://192.168.2.60:8123/api/websocket'
   Home Assistant Agent            Bedside Lamp: Starting device with address: switch.bedroom_gosund
   Home Assistant Agent Debug      Bedside Lamp: switch.bedroom_gosund not in ha_entity_map[switch][bedroom_gosund]
   Home Assistant Agent            Cellular Modem: Starting device with address: switch.lr_gosund
   Home Assistant Agent Debug      Service Home._home-assistant._tcp.local. of type _home-assistant._tcp.local. state changed: ServiceStateChange.Added
   Home Assistant Agent Debug      Cellular Modem: switch.lr_gosund not in ha_entity_map[switch][lr_gosund]
   Home Assistant Agent            Pentair Air Temp mqtt: Starting device with address: sensor.pentair_airtemp
   Home Assistant Agent Debug      Pentair Air Temp mqtt: sensor.pentair_airtemp not in ha_entity_map[sensor][pentair_airtemp]
   Home Assistant Agent            Pentair Alkalinity: Starting device with address: sensor.pentair_alkalinity
   Home Assistant Agent Debug      Pentair Alkalinity: sensor.pentair_alkalinity not in ha_entity_map[sensor][pentair_alkalinity]
   Home Assistant Agent            Pentair Calcium: Starting device with address: sensor.pentair_calcium
   Home Assistant Agent Debug      Pentair Calcium: sensor.pentair_calcium not in ha_entity_map[sensor][pentair_calcium]
   Home Assistant Agent            Pentair Cyanuric Acid: Starting device with address: sensor.pentair_cyanuricacid
   Home Assistant Agent Debug      Pentair Cyanuric Acid: sensor.pentair_cyanuricacid not in ha_entity_map[sensor][pentair_cyanuricacid]
   Home Assistant Agent            Pentair ORP: Starting device with address: sensor.pentair_orp
   Home Assistant Agent Debug      Pentair ORP: sensor.pentair_orp not in ha_entity_map[sensor][pentair_orp]
   Home Assistant Agent            Pentair pH: Starting device with address: sensor.pentair_ph
   Home Assistant Agent Debug      Pentair pH: sensor.pentair_ph not in ha_entity_map[sensor][pentair_ph]
   Home Assistant Agent            Pentair Pool Temperature: Starting device with address: sensor.pentair_pooltemp
   Home Assistant Agent Debug      Pentair Pool Temperature: sensor.pentair_pooltemp not in ha_entity_map[sensor][pentair_pooltemp]
   Home Assistant Agent            Pentair Spa Temperature: Starting device with address: sensor.pentair_spatemp
   Home Assistant Agent Debug      Pentair Spa Temperature: sensor.pentair_spatemp not in ha_entity_map[sensor][pentair_spatemp]
   Home Assistant Agent Debug      Service info: ServiceInfo(type='_home-assistant._tcp.local.', name='Home._home-assistant._tcp.local.', addresses=[b'\xc0\xa8\x02<'], port=8123, weight=0, priority=0, server='bef94705fa4644cf80fdaf6f6ee8d8e1.local.', properties={b'location_name': b'Home', b'uuid': b'bef94705fa4644cf80fdaf6f6ee8d8e1', b'version': b'2023.8.0', b'external_url': b'http://tarheels.ddns.net:8123', b'internal_url': b'http://192.168.2.60:8123', b'base_url': b'http://tarheels.ddns.net:8123', b'requires_api_password': b'True'}, interface_index=None)
   Home Assistant Agent Debug      Service address: 192.168.2.60:8123
   Home Assistant Agent Debug      Found HA Servers: {'Home._home-assistant._tcp.local.': {'ip_address': '192.168.2.60', 'port': 8123}}

Aug 2, 2023 at 8:13:03 PM
   Home Assistant Agent Error      Error in plugin execution GetUiDynamicList:

  File "plugin.py", line 158, in get_entity_list
type: ('sensor',)


Aug 2, 2023 at 8:13:46 PM
   Home Assistant Agent Error      Error in plugin execution GetUiDynamicList:

  File "plugin.py", line 158, in get_entity_list
type: ('binary_sensor',)

   Home Assistant Agent Error      Error in plugin execution GetUiDynamicList:

  File "plugin.py", line 158, in get_entity_list
type: ('light',)


Aug 2, 2023 at 8:14:16 PM
   Home Assistant Agent Error      Error in plugin execution GetUiDynamicList:

  File "plugin.py", line 158, in get_entity_list
type: ('switch',)

   Home Assistant Agent Error      Error in plugin execution GetUiDynamicList:

  File "plugin.py", line 158, in get_entity_list
type: ('climate',)
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Home Assistant plugin updated for Python 3

Post by FlyingDiver »

From what I can see here, it's not actually connecting to a Home Assistant server. It's trying to, but I don't see anything to confirm it actually did.

What version Home Assistant is this? On what platform?

Maybe you don't have the websocket library installed. Do this in Terminal:

Code: Select all

pip3 install websocket-client
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
farberm
Posts: 393
Joined: Sun Feb 24, 2008 2:14 pm

Re: Home Assistant plugin updated for Python 3

Post by farberm »

Awesome...that fixed the list for entities. Now sensors and light and switches seems to work. On my climate devices however the Temperature reads "0". Under the devices details in the Temp field is (null)* and the Last update reads 2000-01-01 00:00:00. Below is the log. I tried three different thermostats (One Ecobee and two Honeywell - Upstairs, Main, Basement)

Error Log..

Code: Select all

Aug 2, 2023 at 9:03:19 PM
   Home Assistant Agent Debug      get_entity_list for filter 'climate': retList = [('climate.basement', 'basement'), ('climate.main', 'main'), ('climate.upstairs', 'upstairs')]
   Home Assistant Agent Debug      menuChanged: typeId = HAclimate, devId = 105245974, valuesDict = UiValuesDict : (dict)
     NumHumidityInputs : 1 (string)
     NumTemperatureInputs : 1 (string)
     ShowCoolHeatEquipmentStateUI : true (bool)
     SupportsCoolSetpoint : true (bool)
     SupportsHeatSetpoint : true (bool)
     SupportsHvacFanMode : true (bool)
     SupportsHvacOperationMode : true (bool)
     SupportsStatusRequest : false (bool)
     address : climate.upstairs (string)
   Home Assistant Agent Debug      get_entity_list for filter 'climate': retList = [('climate.basement', 'basement'), ('climate.main', 'main'), ('climate.upstairs', 'upstairs')]
   Home Assistant Agent            new device 6: Starting device with address: climate.upstairs
   Home Assistant Agent Debug      Updating device new device 6 with {'entity_id': 'climate.upstairs', 'state': 'heat_cool', 'attributes': {'hvac_modes': ['heat_cool', 'heat', 'cool', 'off'], 'min_temp': 44.6, 'max_temp': 95.0, 'target_temp_step': 0.5, 'fan_modes': ['auto', 'on'], 'preset_modes': ['Away', 'Home', 'Sleep'], 'current_temperature': 74.9, 'temperature': None, 'target_temp_high': 75.0, 'target_temp_low': 64.0, 'current_humidity': 52, 'fan_mode': 'auto', 'hvac_action': 'idle', 'preset_mode': 'temp', 'fan': 'off', 'climate_mode': 'Home', 'equipment_running': '', 'fan_min_on_time': 10, 'friendly_name': 'Upstairs', 'supported_features': 27}, 'last_changed': '2023-08-02T22:09:29.681786+00:00', 'last_updated': '2023-08-03T01:00:30.504690+00:00', 'context': {'id': '01H6WEJ5D8F76YZ6HTTWTT30QH', 'parent_id': None, 'user_id': None}}
   Home Assistant Agent Error      Error in plugin execution ServerReplacedElem:

  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/plugin_base.py", line 1379, in device_updated
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/plugin_base.py", line 1315, in _dispatch_device_start_comm
  File "plugin.py", line 131, in deviceStartComm
  File "plugin.py", line 203, in update_device
type: ('heat_cool',)

   Home Assistant Agent Debug      Updating device new device 6 with {'entity_id': 'climate.upstairs', 'state': 'heat_cool', 'attributes': {'hvac_modes': ['heat_cool', 'heat', 'cool', 'off'], 'min_temp': 44.6, 'max_temp': 95.0, 'target_temp_step': 0.5, 'fan_modes': ['auto', 'on'], 'preset_modes': ['Away', 'Home', 'Sleep'], 'current_temperature': 74.7, 'temperature': None, 'target_temp_high': 75.0, 'target_temp_low': 64.0, 'current_humidity': 51, 'fan_mode': 'auto', 'hvac_action': 'idle', 'preset_mode': 'temp', 'fan': 'off', 'climate_mode': 'Home', 'equipment_running': '', 'fan_min_on_time': 10, 'friendly_name': 'Upstairs', 'supported_features': 27}, 'last_changed': '2023-08-02T22:09:29.681786+00:00', 'last_updated': '2023-08-03T01:03:30.450943+00:00', 'context': {'id': '01H6WEQN4JDA53M3D2JVPKNSAG', 'parent_id': None, 'user_id': None}}
   Home Assistant Agent Error      Websocket state_changed exception: 'heat_cool'
   Home Assistant Agent Debug      Websocket state_changed:
{'id': 1, 'type': 'event', 'event': {'event_type': 'state_changed', 'data': {'entity_id': 'climate.upstairs', 'old_state': {'entity_id': 'climate.upstairs', 'state': 'heat_cool', 'attributes': {'hvac_modes': ['heat_cool', 'heat', 'cool', 'off'], 'min_temp': 44.6, 'max_temp': 95.0, 'target_temp_step': 0.5, 'fan_modes': ['auto', 'on'], 'preset_modes': ['Away', 'Home', 'Sleep'], 'current_temperature': 74.9, 'temperature': None, 'target_temp_high': 75.0, 'target_temp_low': 64.0, 'current_humidity': 52, 'fan_mode': 'auto', 'hvac_action': 'idle', 'preset_mode': 'temp', 'fan': 'off', 'climate_mode': 'Home', 'equipment_running': '', 'fan_min_on_time': 10, 'friendly_name': 'Upstairs', 'supported_features': 27}, 'last_changed': '2023-08-02T22:09:29.681786+00:00', 'last_updated': '2023-08-03T01:00:30.504690+00:00', 'context': {'id': '01H6WEJ5D8F76YZ6HTTWTT30QH', 'parent_id': None, 'user_id': None}}, 'new_state': {'entity_id': 'climate.upstairs', 'state': 'heat_cool', 'attributes': {'hvac_modes': ['heat_cool', 'heat', 'cool', 'off'], 'min_temp': 44.6, 'max_temp': 95.0, 'target_temp_step': 0.5, 'fan_modes': ['auto', 'on'], 'preset_modes': ['Away', 'Home', 'Sleep'], 'current_temperature': 74.7, 'temperature': None, 'target_temp_high': 75.0, 'target_temp_low': 64.0, 'current_humidity': 51, 'fan_mode': 'auto', 'hvac_action': 'idle', 'preset_mode': 'temp', 'fan': 'off', 'climate_mode': 'Home', 'equipment_running': '', 'fan_min_on_time': 10, 'friendly_name': 'Upstairs', 'supported_features': 27}, 'last_changed': '2023-08-02T22:09:29.681786+00:00', 'last_updated': '2023-08-03T01:03:30.450943+00:00', 'context': {'id': '01H6WEQN4JDA53M3D2JVPKNSAG', 'parent_id': None, 'user_id': None}}}, 'origin': 'LOCAL', 'time_fired': '2023-08-03T01:03:30.450943+00:00', 'context': {'id': '01H6WEQN4JDA53M3D2JVPKNSAG', 'parent_id': None, 'user_id': None}}}
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Home Assistant plugin updated for Python 3

Post by FlyingDiver »

You can turn off extra debugging.

I think I may know what it is. I'll check tomorrow.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
farberm
Posts: 393
Joined: Sun Feb 24, 2008 2:14 pm

Re: Home Assistant plugin updated for Python 3

Post by farberm »

Thx
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Home Assistant plugin updated for Python 3

Post by FlyingDiver »

What's the HVAC mode on your thermostats?
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
farberm
Posts: 393
Joined: Sun Feb 24, 2008 2:14 pm

Re: Home Assistant plugin updated for Python 3

Post by farberm »

Different Modes for each for testing

Upstairs (Ecobee): Heat/Cool
Main (Honeywell): Heat/Cool
Basement (Honeywell): Cool
Locked

Return to “Home Assistant Agent”