cyberjunky / home-assistant-custom-components

My custom components for Home Assistant
MIT License
71 stars 19 forks source link

Plugwise timeouts #31

Closed Fietspomp86 closed 4 years ago

Fietspomp86 commented 5 years ago

Hey, love the plugwise component. I have 9 circles and 1 circle+. When using the Windows software it finds them all, but when I use Home Assistant i get a lot of timeouts, especially when restarting HASS. After restart some are missing and the only way to get them back is by restarting HASS over and over again untill they are discovered again. Is there any way to give the component more time to discover all the circles?

Running HASS in venv on a NUC btw.

Heres a log example.

2019-05-19 09:41:46 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.homecinema fails Traceback (most recent call last): File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 220, in async_update_ha_state await self.async_device_update() File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 377, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/homeassistant/.homeassistant/custom_components/plugwise/switch.py", line 107, in update self.data.update() File "/home/homeassistant/.homeassistant/custom_components/plugwise/switch.py", line 127, in update self.current_consumption = plugwise.Circle(self.mac, self.stick).get_power_usage() File "/srv/homeassistant/lib/python3.6/site-packages/plugwise/api.py", line 177, in get_power_usage corrected_pulses = self.pulse_correction(pulse_1s) File "/srv/homeassistant/lib/python3.6/site-packages/plugwise/api.py", line 125, in pulse_correction self.calibrate() File "/srv/homeassistant/lib/python3.6/site-packages/plugwise/api.py", line 143, in calibrate calibration_response = self._expect_response(PlugwiseCalibrationResponse) File "/srv/homeassistant/lib/python3.6/site-packages/plugwise/api.py", line 114, in _expect_response return self._comchan.expect_response(response_class, self.mac) File "/srv/homeassistant/lib/python3.6/site-packages/plugwise/api.py", line 73, in expect_response retval = self._recv_response(resp) File "/srv/homeassistant/lib/python3.6/site-packages/plugwise/api.py", line 53, in _recv_response raise TimeoutException("Timeout while waiting for response from device") plugwise.exceptions.TimeoutException: Timeout while waiting for response from device

EDIT: Tried to adjust the DEFAULT_TIMEOUT = 10 in the /srv/homeassistant/lib/python3.6/site-packages/plugwise/api.py file, this helps a little. Using CyberJunky's plugwise lib.

cyberjunky commented 4 years ago

I have only one plug left, so cannot test with multiple. I have updated the component somewhat a made it work with hass.io, can you copy plugwise/switch.py and manifest.json and test again, if it still doesn't work I will have a look.

Fietspomp86 commented 4 years ago

I just sold my plugs because it wasn't working properly so I can't test anymore, sorry. I switched to blitzwolf WiFi plugs now. Maybe somebody else can test it for you?

cyberjunky commented 4 years ago

You use/flashed the blitzwolf WiFi plugs with esphome firmware to include them into HA? Any pointers, links etc?

Fietspomp86 commented 4 years ago

Going offtopic but yes, I flashed them with tasmota which works perfect with auto discovery into hass. Haven't tried ESPhome though, I use that for some esp32 s which is also nice and user friendly. The tasmota repository has great wiki for blitzwolf shp6 and shp2. Power usage is a bit more unstable compared to plugwise (more peaks etc but it can be stabilized by measuring averages), but on/off works perfect and they have a button for on/off. The shp6 is also very small so it doesn't take up more space than a normal plug.

cyberjunky commented 4 years ago

Closed, cannot reproduce due to lack of hardware.