araines / homeassistant-thermoplus-ble

Bluetooth adapter for Home Assistant compatible with Thermoplus (Sensor Blue) BLE thermometers
MIT License
7 stars 3 forks source link

Sensors don't update after HASS restart #13

Open grazmarks opened 3 years ago

grazmarks commented 3 years ago

Hi,

My thermoplus_ble sensors only update after a restart of HASS anymore. It used to work before in more or less regular intervals which normally never exceeded 10 minutes.

There was no change in the setup besides a template sensor that I added and removed again after playing around with it a little bit.

Does anyone else experience a similar problem? The sensors work fine when I open them in the native sensor app.

Any advice or hint into the right direction would be appreciated.

Many thanks!

2021-03-23 13:26:52 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/thermoplus_ble/sensor.py", line 54, in update
    self.process()
  File "/config/custom_components/thermoplus_ble/sensor.py", line 75, in process
    data = self.parse_event(event)
  File "/config/custom_components/thermoplus_ble/sensor.py", line 112, in parse_event
    entries.append({
MemoryError
2021-03-23 13:39:21 ERROR (Thread-30) [homeassistant] Error doing job: Fatal read error on socket transport
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 848, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
MemoryError
titiviking commented 3 years ago

I have the same issue. Could be due to some update of HA as I only experience this since last upgrade... No idea why... Debugging the component, I do see a lot of BLE devices being listed... It even tells me "1 known sensor", but no update to the values.

araines commented 3 years ago

I'm not experiencing this problem, but I'm also not running the latest versions of HA/HASS because of instability issues on raspberry pi. Perhaps if you could both note of your hardware, hassOS version (if applicable) and home assistant version then we could find a pattern?

titiviking commented 3 years ago
grazmarks commented 3 years ago

Raspberry Pi 4 Model B 4GB Home assistant 2021.3.4 Running on docker via docker compose

I hadn't experienced this issue after switching from starting the container directly with docker run to docker compose. Ran fine for a week. Same issue again but no exception in the logs this time.

Whats interesting tough is that I have a template sensor that derives from the thermopiles sensor, and that sensor updates regularly:

      arbeitszimmer_humidity:
        friendly_name: "Arbeitszimmer Humidity"
        value_template: "{{ state_attr('sensor.thermoplus_e9_47_00_00_0c_2e', 'humidity') }}"
        unit_of_measurement: '%'
        device_class: humidity
grazmarks commented 3 years ago
  • raspberry pi 4 model B
  • rasberian (up to date)
  • HassIO supervised (latest) (on docker)

May I ask how you are running HassIO supervised in a container? I remember doing some research on this but decided that it would be too invasive and that I'd rather go for a vanilla HassOS in case I need it.

araines commented 3 years ago

I'm now experiencing some problems with this integration as well, although I'm not seeing the error messages described here. Given there is actually a much better maintained & feature-rich passive BLE component in the ecosystem, I've requested that support for Thermoplus sensors can be integrated in that component instead: https://github.com/custom-components/ble_monitor/issues/393

I'm hoping the maintainers are open to that proposal.

Edit: through messing about a bit, I've discovered my problem goes away when I've got the ble_monitor installed as well and configured to have "active scan" enabled. I don't know if this will work as a temp workaround for anyone else - it kinda suggests there is probably some kind of nasty bug in this implementation.

araines commented 3 years ago

I'm recommending that people use ble_monitor (https://github.com/custom-components/ble_monitor) from this point forwards. The maintainers there have kindly integrated support for Thermoplus sensors as of version 3.1 (currently in beta). It also has a whole host of other features beyond this component which I think are great.