Hey Everyone, I have a question about connecting a device to HA via ESPHome. Currently, I have a MiFlora plant sensor that is connected to my rpi with HA and I have a few ESP32’s around the house for some other sensors. The MiFlora sensor is going to be used out of range from where my rpi is located. Right now, the MiFlora is connected and working.
Here is my code in the configuration.yaml:
sensor:
- platform: miflora
mac: 'C4:7C:8D:63:E3:E4'
name: plant_1
force_update: true
median: 3
go_unavailable_timeout: 43200
monitored_conditions:
- moisture
- light
- temperature
- conductivity
- battery
and
plant:
plant_1:
sensors:
moisture: sensor.plant_1_moisture
battery: sensor.plant_1_battery
temperature: sensor.plant_1_temperature
conductivity: sensor.plant_1_conductivity
brightness: sensor.plant_1_light
min_moisture: 15
max_moisture: 60
min_battery: 15
min_temperature: 5
max_temperature: 35
min_conductivity: 350
max_conductivity: 2000
min_brightness: 3000
max_brightness: 70000
What I want to know is what do I need to do to connect it to one of the ESP32’s? Do I need to copy the sensor portion of the code to the ESPHome configuration or all of the code? I had originally set it up in ESPHome but I didn’t get any information from it. It was all ‘unknown’.
I thank you in advance for your time and help!
parrel
(Parrel)
December 2, 2020, 7:53pm
2
This is a sample of the YAML you need to add to ESPHome.
sensor:
- platform: xiaomi_hhccjcy01
mac_address: '94:2B:FF:5C:91:61'
temperature:
name: "Xiaomi HHCCJCY01 Temperature"
moisture:
name: "Xiaomi HHCCJCY01 Moisture"
illuminance:
name: "Xiaomi HHCCJCY01 Illuminance"
conductivity:
name: "Xiaomi HHCCJCY01 Soil Conductivity"
battery_level:
name: "Xiaomi HHCCJCY01 Battery Level"
Some things to note are that ESPHome does not poll the sensor, but uses a passive method. Also the battery level sensor may not work.
More info here:
Great, thank you! Do you know if I should remove the sensor entry from the configuration.yaml? I’m still fairly new to HA and keep learning the hard way. It takes a while to update so I would rather try to get it right the first time. I appreciate your help.
nanobra1n
(Nanobra1n)
December 2, 2020, 8:34pm
4
Yes, you can delete the sensor
part in your configuration.yaml
. In your plant
section the sensor names will need to change to sensor.xiaomi_hhccjcy01_temperature
etc.
1 Like
I think I’m missing something. When I go into ESPHome and show the logs for the sensor, it displays this:
[07:35:34][C][xiaomi_hhccjcy01:012]: Xiaomi HHCCJCY01
[07:35:34][C][xiaomi_hhccjcy01:013]: Temperature ‘Mi Flora Temperature’
[07:35:34][C][xiaomi_hhccjcy01:013]: Unit of Measurement: ‘°C’
[07:35:34][C][xiaomi_hhccjcy01:013]: Accuracy Decimals: 1
[07:35:34][C][xiaomi_hhccjcy01:013]: Icon: ‘mdi:thermometer’
[07:35:34][C][xiaomi_hhccjcy01:014]: Moisture ‘Mi Flora Humidity’
[07:35:34][C][xiaomi_hhccjcy01:014]: Unit of Measurement: ‘%’
[07:35:34][C][xiaomi_hhccjcy01:014]: Accuracy Decimals: 0
[07:35:34][C][xiaomi_hhccjcy01:014]: Icon: ‘mdi:water-percent’
[07:35:34][C][xiaomi_hhccjcy01:015]: Conductivity ‘Mi Flora Conductivity’
[07:35:34][C][xiaomi_hhccjcy01:015]: Unit of Measurement: ‘µS/cm’
[07:35:34][C][xiaomi_hhccjcy01:015]: Accuracy Decimals: 0
[07:35:34][C][xiaomi_hhccjcy01:015]: Icon: ‘mdi:flower’
[07:35:34][C][xiaomi_hhccjcy01:016]: Illuminance ‘Mi Flora Brightness’
[07:35:34][C][xiaomi_hhccjcy01:016]: Unit of Measurement: ‘lx’
[07:35:34][C][xiaomi_hhccjcy01:016]: Accuracy Decimals: 0
[07:35:34][C][xiaomi_hhccjcy01:016]: Icon: ‘mdi:brightness-5’
[07:35:34][C][xiaomi_hhccjcy01:017]: Battery Level ‘Mi Flora Battery’
[07:35:34][C][xiaomi_hhccjcy01:017]: Unit of Measurement: ‘%’
[07:35:34][C][xiaomi_hhccjcy01:017]: Accuracy Decimals: 0
[07:35:34][C][xiaomi_hhccjcy01:017]: Icon: ‘mdi:battery’
I think that means it’s seeing it. Sorry, still new to this and I have read a lot of posts and some conflict so I’m not exactly sure.
My ESPHome Sensor yaml:
sensor:
- platform: xiaomi_hhccjcy01
mac_address: C4:7C:8D:63:E3:17 # Mi Flora MAC Address
temperature:
id: mi_flora_temperature
name: "Mi Flora Temperature"
moisture:
id: mi_flora_humidity
name: "Mi Flora Humidity"
illuminance:
id: mi_flora_brightness
name: "Mi Flora Brightness"
conductivity:
id: mi_flora_conductivity
name: "Mi Flora Conductivity"
battery_level:
id: mi_flora_battery
name: "Mi Flora Battery"
And here is my configuration yaml:
plant:
plant_2:
sensors:
moisture: sensor.mi_flora_moisture
battery: sensor.mi_flora_battery
temperature: sensor.mi_flora_temperature
conductivity: sensor.mi_flora_conductivity
brightness: sensor.mi_flora_brightness
min_moisture: 20
max_moisture: 60
min_battery: 17
min_conductivity: 500
min_temperature: 15
I have had it running since last night and it reports unknown for everything. Does anyone know where I messed up? I appreciate the help.
nanobra1n
(Nanobra1n)
December 5, 2020, 3:26pm
6
Are you actually seeing values being updated in your log? E.g. like this:
[10:19:05][D][xiaomi_ble:273]: Got Xiaomi HHCCJCY01 (C4:7C:8D:66:39:35):
[10:19:05][D][xiaomi_ble:291]: Moisture: 36%
[10:19:05][D][sensor:092]: 'Fern Sr Moisture': Sending state 36.00000 % with 0 decimals of accuracy
[10:19:13][D][xiaomi_ble:273]: Got Xiaomi HHCCJCY01 (C4:7C:8D:64:10:84):
[10:19:13][D][xiaomi_ble:288]: Illuminance: 10068lx
[10:19:13][D][xiaomi_ble:303]: Light: off
[10:19:13][D][sensor:092]: 'Fern Jr L Illuminance': Sending state 10068.00000 lx with 0 decimals of accuracy
[10:19:13][D][xiaomi_ble:273]: Got Xiaomi HHCCJCY01 (C4:7C:8D:66:39:35):
[10:19:13][D][xiaomi_ble:285]: Conductivity: 202µS/cm
[10:19:13][D][sensor:092]: 'Fern Sr Soil Conductivity': Sending state 202.00000 µS/cm with 0 decimals of accuracy
[10:19:20][D][xiaomi_ble:273]: Got Xiaomi HHCCJCY01 (C4:7C:8D:64:10:84):
[10:19:20][D][xiaomi_ble:288]: Illuminance: 10068lx
[10:19:20][D][xiaomi_ble:303]: Light: off
[10:19:20][D][sensor:092]: 'Fern Jr L Illuminance': Sending state 10068.00000 lx with 0 decimals of accuracy
[10:19:21][D][xiaomi_ble:273]: Got Xiaomi HHCCJCY01 (C4:7C:8D:64:10:84):
[10:19:21][D][xiaomi_ble:291]: Moisture: 19%
If not, your mac address might be wrong or you are not in range. Just to rule this out: does your esp32 even have bluetooth?
Yes, I have the correct MAC and it sees it.
[16:57:43][D][esp32_ble_tracker:544]: Found device C4:7C:8D:63:E3:17 RSSI=-60
[16:57:43][D][esp32_ble_tracker:565]: Address Type: PUBLIC
[16:57:43][D][esp32_ble_tracker:567]: Name: ‘Flower care’
I use the sensor to connect to a Xiaomi lywsd03mmc for Temp/Humidity. Could that be an issue?
esphome:
name: 'bt_sensor_s_room'
platform: ESP32
board: mhetesp32devkit
nanobra1n
(Nanobra1n)
December 6, 2020, 2:50am
8
It shouldn’t be an issue, I have 4 different hhccjcy01 connected. Also, my RSSI is much lower (-70 to -90) yet it works for me,.
Here is my configuration, see if there are any obvious differences to yours:
esphome:
name: bt_hub
platform: ESP32
board: nodemcu-32s
wifi:
ssid: "SSID"
password: !secret SSID_pwd
fast_connect: on
manual_ip:
static_ip: 192.168.1.231
gateway: 192.168.1.1
subnet: 255.255.255.0
dns1: 192.168.1.1
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Bt Hub Fallback Hotspot"
password: "anotherpassword"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
esp32_ble_tracker:
sensor:
- platform: xiaomi_hhccjcy01
mac_address: 'C4:7C:8D:66:39:35'
temperature:
name: "Fern Sr Temperature"
moisture:
name: "Fern Sr Moisture"
illuminance:
name: "Fern Sr Illuminance"
conductivity:
name: "Fern Sr Soil Conductivity"
battery_level:
name: "Fern Sr Battery Level"
- platform: xiaomi_hhccjcy01
mac_address: 'C4:7C:8D:6B:83:74'
temperature:
name: "Fern Jr R Temperature"
moisture:
name: "Fern Jr R Moisture"
illuminance:
name: "Fern Jr R Illuminance"
conductivity:
name: "Fern Jr R Soil Conductivity"
battery_level:
name: "Fern Jr R Battery Level"
- platform: xiaomi_hhccjcy01
mac_address: 'C4:7C:8D:64:10:84'
temperature:
name: "Fern Jr L Temperature"
moisture:
name: "Fern Jr L Moisture"
illuminance:
name: "Fern Jr L Illuminance"
conductivity:
name: "Fern Jr L Soil Conductivity"
battery_level:
name: "Fern Jr L Battery Level"
- platform: xiaomi_hhccjcy01
mac_address: '80:EA:CA:89:4D:10'
temperature:
name: "Aloe Aristata Temperature"
moisture:
name: "Aloe Aristata Moisture"
illuminance:
name: "Aloe Aristata Illuminance"
conductivity:
name: "Aloe Aristata Soil Conductivity"
battery_level:
name: "Aloe Aristata Battery Level"
- platform: wifi_signal
name: "BT Hub WiFi Signal Sensor"
update_interval: 60s
I tried copying your code over (with my info) but I get nothing. Do you have anything in your configuration.yaml or is that all the code you use?
nanobra1n
(Nanobra1n)
December 8, 2020, 4:40pm
10
I am sorry you have so many issues with this.
In my configuration.yaml
I have this:
plant:
Fern Sr:
sensors:
moisture: sensor.fern_sr_moisture
temperature: sensor.fern_sr_temperature
conductivity: sensor.fern_sr_conductivity
brightness: sensor.fern_sr_light_intensity
battery: sensor.fern_sr_battery
min_moisture: 15
max_moisture: 60
min_conductivity: 350
max_conductivity: 1500
Fern Jr (R):
sensors:
moisture: sensor.fern_jr_r_moisture
temperature: sensor.fern_jr_r_temperature
conductivity: sensor.fern_jr_r_conductivity
brightness: sensor.fern_jr_r_light_intensity
battery: sensor.fern_jr_r_battery
min_moisture: 15
max_moisture: 60
min_conductivity: 350
max_conductivity: 1500
Fern Jr (L):
sensors:
moisture: sensor.fern_jr_l_moisture
temperature: sensor.fern_jr_l_temperature
conductivity: sensor.fern_jr_l_conductivity
brightness: sensor.fern_jr_l_light_intensity
battery: sensor.fern_jr_l_battery
min_moisture: 15
max_moisture: 60
min_conductivity: 350
max_conductivity: 1500
Aloe aristata:
sensors:
moisture: sensor.aloe_aristata_moisture
temperature: sensor.aloe_aristata_temperature
conductivity: sensor.aloe_aristata_conductivity
brightness: sensor.aloe_aristata_light_intensity
battery: sensor.aloe_aristata_battery
min_moisture: 7
max_moisture: 50
min_conductivity: 300
max_conductivity: 1000
Do you have the ESPHome integration installed? If so, does your esp show up there?
Yes, I have ESPHome installed. I am running 3 other ESP32 sensors for collecting temp/humidity info. I followed this video for that: https://youtu.be/K-HG7qs9hK0 .
I had another ESP32 board so I decided to try that as a stand-alone sensor and I copied your code to it (with my info). I then copied your configuration info to mine to see if that works. It’s been about 20 minutes and I’ve read it can take up 45 minutes to get info.
Looking at the ESPHome logs for the sensor, it sees both of my plant sensors. The one that works is connected directly to the rpi running Home Assistant and seems to work with no issues. I’m just having trouble connecting this one through ESPHome.
I decided to try connecting it to my rpi instead of the ESPHome sensor to see if it would connect there. Before I did that, I tried hooking up the last plant sensor (all are Northfifteen) that I had and it connected to the rpi. The problem sensor is Plant 2.
Tomorrow I will try connecting 3 to the sensor.
parrel
(Parrel)
December 9, 2020, 7:08am
13
You need to update the north sensors in the flower care app to have them work in ESPHome.
Ok, thank you, I will try that.
On a side note, I went into ESPHome and there were still entities for plant 2 even though I removed them from the sensor yaml. I had to delete the sensor from the integrations and then it gave me plant 2’s humidity and temperature.
Thank you, both, for your help. I really appreciate your time spent helping me. I have it working now and it was the app firmware update. Neither of the tutorials I read about setting it up said anything about that. Now if I could just figure out the battery issue.
parrel
(Parrel)
December 9, 2020, 9:07pm
17
Sorry, the battery sensor will not work in ESPHome. From the ESPHome page:
Note
Newer versions of HHCCJCY01 ship with firmware 3.2.1, and they don’t send the battery level data anymore .
1 Like
If anybody encounters the same issue I just recently had same problem as OP. The plant sensors from North were older, sitting in a box for more than a year and I finally decided to integrate them. They didn’t show proper values in ESPHome.
I had to do a firmware update on your MiFlora sensors. (mine went from v2.7.0 to v3.5.0)
I used the Plant Care app.
After that ESPHome started picking up the correct values immediately.
3 Likes
does no appear to work for me any suggestions?
You can try the other integration https://github.com/custom-components/ble_monitor
It does work there too, but I got it working in both after the firmware update.
What’s your firmware version now ?