https://shop.allnetchina.cn/collections/quinled/products/quinled-esp32?variant=39253005828198
Would some kind soul provide me a link to the appropriate Community Forum to enquire how I can get my previously working BH1750 light-sensor using Raspberry Pi GPIO to work using either the community rpi_gpio integration or ESPHome, now that inbuilt GPIO has been deprecated from HomeAssistant? (I just dont know where the right place is to get help on this)
Hi - thanks for the link, although I rather thought the GitHub page was more for reporting issues rather than general ‘how do I get this working’ requests for support?
However, I think I have since realised that rpi_gpio integration is not what I need - it seems to support only binary sensors, whereas my BH1750 light sensor is an analogue device. That being the case, I think I can add myself to the group of HomeAssistant users, angry at the deprecation of GPIO without an adequate alternative (it’s a bit like Ford Motor Co. suddenly deciding all their new models will ship without engines installed!)
How could it have worked before then?
Anyways… using ESP-Home you can use this:
BH1750 Ambient Light Sensor — ESPHome
The custom integration that is linked there is the one that home assistant is deprecating. It’s the exact same code. If the custom integration doesn’t work for you, then the build-in deprecated integration wouldn’t have worked either. I.e. There’s no reason to be upset as it wouldn’t have worked for you anyways.
Well, it definitely worked in HomeAssistant before. This is the details I had in my configuration.yaml:
sensor:
- platform: bh1750
name: boiler
i2c_address: 0x23
operation_mode: continuous_low_res_mode
sensitivity: 254
measurement_delay_ms: 400
scan_interval: 30
I was under the impression that the new rpi_gpio integration only provided for binary_sensor, whereas my BH1750 is a ‘sensor’?
I tried ESPHome but started to realise that you need the BH1750 connect to some kind of ESP32 board (not sure if I’ve understood correctly) whereas my BH1750 is wired directly to the GPIO pins on my rpi2b as shown here:
https://www.raspberrypi-spy.co.uk/2015/03/bh1750fvi-i2c-digital-light-intensity-sensor/
There’s obviously something I’m missing. The code added to my configuration.yaml used to work:
sensor:
- platform: bh1750
name: boiler
i2c_address: 0x23
operation_mode: continuous_low_res_mode
sensitivity: 254
measurement_delay_ms: 400
scan_interval: 30
Now I’ve upgraded HomeAssistant to the latest version (with the deprecated GPIO functionality), I’ve installed the rpi_gpio custom integration, and “platform: bh1750” now results in a failed configuration.yaml check.
So how do I get HomeAssistant to recognise “platform: bh1750” using the new rpi_gpio integration? What am I not understanding?
That integration hasn’t been made custom, but you can make a custom integration out of them.
copy these files into <your config>\custom_components\bh1750\
add
"version": "1.0",
on the second line of manifest.json.
Restart HA.
Oh okay, cool. Do I still need to keep the rpi_gpio integration installed? I’m assuming I do.
Nope, no need.
just to let you know, it’s going to warn you about it’s removal in the logs. You can just ignore that or remove lines 77 to 82 in sensor.py. Basically, this chunk
_LOGGER.warning(
"The BH1750 integration is deprecated and will be removed "
"in Home Assistant Core 2022.4; this integration is removed under "
"Architectural Decision Record 0019, more information can be found here: "
"https://github.com/home-assistant/architecture/blob/d1639d2c8b1ac697aa95d2177d1db2cac0cf2f97/adr/0019-GPIO.md"
)
You’re a genius sir!
I’ve now got my BH1750 sensor working in the latest Home Assistant & it’s doing exactly what I needed. I did have to mess around a bit with ‘HassOS i2c Configurator’ AddOn before I got it working, but it’s working fine now - thank you for your help.
Although you didn’t actually need rpi_gpio
, what I pointed to is the exact “how do I get it worling”
I agree and am also very unhappy with de removal of RP_GPIO and DHT, Seems we users are guilty on not activating reporting our system to the developers so they think the integration is not used. I made a downgrade but this is not the solution. This is my first contribution ever. greetings
You don’t need to downgrade, please read the thread.
This will fix it. Tride and now all is back to normal
Cherrs
Closing this thread and locking it to keep Grahams post at the bottom. If you’d like to discuss the removal of GPIO, please create a new thread. I have to do this because Social topics do not have a solution checkbox and this gives people searching for the replacement a place to look.
Please use the library linked by @Graham1 in the previous post.