scottyphillips / echonetlite_homeassistant

A Home Assistant custom component for use with ECHONET enabled devices.
MIT License
137 stars 42 forks source link

Failed to call service climate/set_hvac_mode. 'MitsubishiClimate' object has no attribute '_on' #21

Closed girkers closed 3 years ago

girkers commented 3 years ago

Updated to latest HASS 2021.5.0 and now I cannot turn on my AirCon.

Have reinstalled the add on via HACS and now using version 2.0.1.

Here is the error log from HASS: `

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/mitsubishi/climate.py:232 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 11:24:11 AM (3 occurrences) Last logged: 11:24:44 AM [140540403953328] 'MitsubishiClimate' object has no attribute '_on'

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 167, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1481, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1516, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 726, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call await result File "/config/custom_components/mitsubishi/climate.py", line 232, in async_set_hvac_mode if self._on == False: AttributeError: 'MitsubishiClimate' object has no attribute '_on'

`

girkers commented 3 years ago

Further info in the log `This error originated from a custom integration.

Logger: custom_components.mitsubishi.climate Source: custom_components/mitsubishi/climate.py:136 Integration: mitsubishi (documentation) First occurred: 11:24:11 AM (4 occurrences) Last logged: 11:26:25 AM

HA requested an update from HVAC 192.168.72.92 but no data was received`

The IP address is the Air Con I am trying to turn on, which it already is, can still access the unit via the native app on my phone.

I have another three (3) of these units that are working fine.

I will go a reset the WiFi controller on the unit.

girkers commented 3 years ago

Did a reset/reboot of the adapter and still no good, turned Echonet Lite off and then on again still not good. Still getting these errors on this unit alone: `Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/mitsubishi/climate.py:232 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 11:24:11 AM (8 occurrences) Last logged: 11:48:26 AM

[140540403953328] 'MitsubishiClimate' object has no attribute '_on' [140540383132784] 'MitsubishiClimate' object has no attribute '_on' [140540387173760] 'MitsubishiClimate' object has no attribute '_on' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 167, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1481, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1516, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 726, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call await result File "/config/custom_components/mitsubishi/climate.py", line 232, in async_set_hvac_mode if self._on == False: AttributeError: 'MitsubishiClimate' object has no attribute '_on' `

scottyphillips commented 3 years ago

Once upon a time the default climate class in Home assistant had an _on attribute. This got removed at some stage which means we now need to properly invoke it when the object instance is initialised (which is only happening if everything is running normally). And what I think is happening is that the one unit you are having dramas is no longer reachable via the IP address you got configured. The error in the code is that I only initialize '_on' if the HVAC returns a value when it is first installed into HA.

Its a legit bug on my part and I will fix it up but since you mentioned other HVAC systems are working it is also an issue with one of your units - maybe its IP address has changed - double check that the HVAC system you are having issues with in particular double check its IP address...

scottyphillips commented 3 years ago

Can you test 2.0.2 and double check your HVAC IP address settings please?

girkers commented 3 years ago

Scotty you are a scholar and a gentleman, that has fixed it. They all work.

I have my HVAC IP set via MAC address reservation and the IP address is outside the normal DHCP range so I believe the IP address was fine and as this fix authentic that it worked.