home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.8k stars 30.06k forks source link

miflora component issue. #11815

Closed tehbrd closed 6 years ago

tehbrd commented 6 years ago

Home Assistant release (hass --version): 0.61.1

Python release (python3 --version): Python 3.6.3

Component/platform: hass.io rpi3

Description of problem: miflora sensors no longer collect data

Expected: sensors collect data, did prior to .61

Problem-relevant configuration.yaml entries and steps to reproduce:

sensor:
  - platform: miflora
    mac: 'XX:XX:XX:XX:XX:XX'
    name: Plant
    force_update: false
    median: 3
    monitored_conditions:
      - moisture
      - light
      - temperature
      - conductivity
      - battery

Traceback (if applicable):

ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.pot_plant_light_intensity fails
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 199, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 306, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/miflora.py", line 135, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/lib/python3.6/site-packages/miflora/miflora_poller.py", line 128, in parameter_value
    self.fill_cache()
  File "/usr/lib/python3.6/site-packages/miflora/miflora_poller.py", line 60, in fill_cache
    firmware_version = self.firmware_version()
  File "/usr/lib/python3.6/site-packages/miflora/miflora_poller.py", line 102, in firmware_version
    _HANDLE_READ_VERSION_BATTERY, self._format_bytes(res))
  File "/usr/lib/python3.6/site-packages/miflora/miflora_poller.py", line 170, in _format_bytes
    return ' '.join([format(c, "02x") for c in raw_data]).upper()

Additional info:

bash-4.4# which gatttool
/usr/bin/gatttool
bash-4.4# hciconfig
hci0:   Type: Primary  Bus: USB
        BD Address: 00:1A:7D:DA:71:10  ACL MTU: 310:10  SCO MTU: 64:8
        UP RUNNING
        RX bytes:1578 acl:7 sco:0 events:94 errors:0
        TX bytes:1284 acl:6 sco:0 commands:80 errors:0

bash-4.4# hcitool lescan
LE Scan ...
67:BC:EE:17:A4:9B (unknown)
67:BC:EE:17:A4:9B (unknown)
67:BC:EE:17:A4:9B (unknown)
67:BC:EE:17:A4:9B (unknown)
XX:XX:XX:XX:XX:XX (unknown)
XX:XX:XX:XX:XX:XX Flower care
67:BC:EE:17:A4:9B (unknown)
67:BC:EE:17:A4:9B (unknown)
67:BC:EE:17:A4:9B (unknown)
67:BC:EE:17:A4:9B (unknown)
67:BC:EE:17:A4:9B (unknown)
67:BC:EE:17:A4:9B (unknown)
<snip>
raccettura commented 6 years ago

I'm getting the same thing.

Not sure if #11284 will make this invalid or not.

forrestjr commented 6 years ago

Do you guys know how we can test to see if BT is working from HASSIO or not?

tehbrd commented 6 years ago

Refer to my post above forrestjr

hciconfig / hcitool lescan should be able to run both those from the host or the guest (homeassistant docker)

In regards to my issue, it went away with a reboot and reappeared on another restart.

tehbrd commented 6 years ago

I was just replicating my issue when I noticed upon reboot hci0 was down. Althought this wasn't the case above.

ChristianKuehnel commented 6 years ago

This is a known bug in miflora: https://github.com/open-homeautomation/miflora/pull/80