[SOLVED] My flora - Python Virtual environment

Hi
I cant get my flora device working. i use a python virt environment.

“flower care” found by “sudo hcitool lescan”
running in python virt env. Python 3.6.5

I have other bluetooth devices in my “known devices” file however i don’t think i have anything new in there since i upgraded to HA 69.1
how can i test BLE from within the python virt env?

`  - platform: miflora
    mac: 'c4:7c:8d:66:0a:08'
    name: Garden pots
    force_update: true 
    median: 1
    monitored_conditions:
      - moisture
      - light
      - temperature
      - conductivity
      - battery

`

In hassio sensors.yaml I have the following…

- platform: miflora
  mac: C4:7C:8D:61:A8:46
  name: MiFlora Bird Of Paradise
  force_update: true
  timeout: 60
  cache: 60*60
  median: 1
  monitored_conditions:
    - moisture
    - light
    - temperature
    - conductivity
    - battery

for each of my plants that I’m monitoring.

Cheers keithh666,
I see a couple of differences, I’ll remove the quotes from the Mac address and add cache settings.

I would still like to know once I’m in the python virtual environment how I test Bluetooth?

If you are in HASSIO I don’t think you can, if in any other environment you just use the standard BT tools, hciscan, bluetoothctl etc. If they aren’t in your ve then install them.

Cheers keith666,
I jumped onto the HA box and did:

    cam@cam-UDOO-x86:~$ sudo su -s /bin/bash homeassistant
    [sudo] password for cam:
    homeassistant@cam-UDOO-x86:/home/cam$ source /srv/homeassistant/bin/activate
    (homeassistant) homeassistant@cam-UDOO-x86:/home/cam$ hcitool lescan
    Set scan parameters failed: Operation not permitted
    (homeassistant) homeassistant@cam-UDOO-x86:/home/cam$ bluetoothctl
    [NEW] Controller 40:A3:CC:06:0E:9A cam-UDOO-x86 [default]
    [NEW] Device C4:7C:8D:66:0A:08 Flower care
    [NEW] Device D0:4F:7E:02:3C:3D Apple TV
    [bluetooth]#

so it looks like the homeassistiant user does have the permis to get to the bluetooth stack.

Ok, I have it working!

This is what i did to get it going:

  1. I goggled the Github package that provides mi flora. https://github.com/open-homeautomation/miflora/.

  2. It mentioned Bluetooth is a bit of a mess, but it told me i needed to ensure there were some dependencies.

  3. from within my pythion virt env i did a :

  • pip install btlewrap (it was already installed)
  • pip install bluepy
    bluepy gave me an error about missing glib stuff.
  1. I came out of the virt env and did:
  • sudo apt-get install libglib2.0-dev
  1. Went back into the python virt env again and did a
  • pip install bluepy (this installed successfully this time)
  1. I then did:
  • sudo systemctl restart [email protected]
    which did restart HA successfully without error, but the miflora still didnt report, but a full reboot did work!
    (maybe i didnt wait long enough to poll?)

here is the pic!
image

1 Like

hello i am new to all this things, i have ssh access,
and i use HA inside Virtual Machine Manager (synology nas), haos-ova-8.2

pip install works as you said ( btlewrap OK , bluepy error)
where do i go to execute sudo apt-get install libglib2.0-dev please ?

best regards