custom-components / ble_monitor

BLE monitor for passive BLE sensors
https://community.home-assistant.io/t/passive-ble-monitor-integration/
MIT License
1.93k stars 248 forks source link

Error doing job: Task exception was never retrieved #633

Closed jump396 closed 2 years ago

jump396 commented 2 years ago

Hi all, i've some problems with temperature/humidity sensors in the past week, i don't know if dependt from last updates...

Logger: homeassistant
Source: custom_components/ble_monitor/sensor.py:577
Integration: Passive BLE monitor (documentation, issues)
First occurred: 08:25:24 (1 occurrences)
Last logged: 08:25:24

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/ble_monitor/sensor.py", line 224, in async_run
    entity.collect(data, period_cnt, batt_attr)
  File "/config/custom_components/ble_monitor/sensor.py", line 577, in collect
    <= data[self.entity_description.key]
KeyError: 'temperature'

there are 2 Thermoplus and 1 MHO-C401 (Azarton), all with original firmware. ASAP i will post debug data log.

Ernst79 commented 2 years ago

We need to do some debugging. Could you try the following: Edit the file /config/custom_components/ble_monitor/sensor.py, replace the following part on line 575-579

        if (
            not self._lower_temp_limit
            <= data[self.entity_description.key]
            <= self._upper_temp_limit
        ):

with the following

        try: 
            test = data[self.entity_description.key]
        except KeyError:
            _LOGGER.error("failing data is %s", data)
        if (
            not self._lower_temp_limit
            <= data[self.entity_description.key]
            <= self._upper_temp_limit
        ):

After that, restart HA. After it fails, there will be another error in your logs, starting with "failing data is ....". Can you post that line here.

jump396 commented 2 years ago

As your request:

failing data is {'firmware': 'Inkbird', 'temperature probe 1': 40.5, 'temperature probe 2': 26.6, 'temperature probe 3': 0, 'temperature probe 4': 26.9, 'temperature probe 5': 0, 'temperature probe 6': 0.8, 'rssi': -68, 'mac': '931200000215', 'type': 'iBBQ-6', 'packet': 'no packet id', 'data': True}

Ernst79 commented 2 years ago

Do you own a Inkbird iBBQ-6 sensor (or your neighbour)? Its a BBQ thermometer with 6 probes. Could you also show the next error, like in your first post?

jump396 commented 2 years ago

i have a 4 probes thermometer, but from before i have HA. it's turn-off. i dont know if my neighbours own it, but i think no.

Traceback (most recent call last):
  File "/config/custom_components/ble_monitor/sensor.py", line 224, in async_run
    entity.collect(data, period_cnt, batt_attr)
  File "/config/custom_components/ble_monitor/sensor.py", line 581, in collect
    <= data[self.entity_description.key]
KeyError: 'temperature'
Ernst79 commented 2 years ago

Could you check if one of your BLE monitor devices as a MAC 93:12:00:00:02:15. You can see this in the sensor attributes. Can you tell me which one (if you can find one).

jump396 commented 2 years ago

Yes i do, it is a Thermoplus - Lanyard Hygrometer

Ernst79 commented 2 years ago

Ok, the iBBQ-6 and Thermoplus Hygrometer apparently have a similar BLE format. I will look into it, to make sure they are being parsed separately.

jump396 commented 2 years ago

ok @Ernst79 many thanks

Ernst79 commented 2 years ago

Could you please try with 7.1.1-beta

jump396 commented 2 years ago

I tried with 7.1.1 beta and it's working fine now. I wait until tomorrow for confim

jump396 commented 2 years ago

All right for me, I close the issue. Many thanks to @Ernst79