Open spatcho opened 12 months ago
Download HEAD to your RPi and try running /data/dbus-i2c/pm25_test.py. If this works, or you have some other example code that works on Venus then we should be able to add it. The existing *_service.py should give you an idea of how to implement it if you want to have a go.
NB: I suggest using the service name com.victronenergy.airquality. There is no formal support for this type of sensor, so I doubt it will be visible in the remote console**. Hopefully, it can still be registered on dbus and exported over mqtt.
**It is possible to add UI components, e.g. the package manager, so it might yet be possible to mod the UI so it appears.
Ok, thanks, I checked. I installed using "main" as branch on package editor. The smbus2 dependency failed because I had no device that needed it and so it wasn't installed at setup. I am getting raw data from the smbus calls. The test script failed with "[Errno 71] Protocol error". If I change "read_block_data" to "read_i2c_block_data" it still fail but with "Invalid PM2.5 header", which I think is better. Difference with Adafruit sample code using CircuitPython, I need to choose a register, maybe 0 is not what to set. Anyways I am not a python/i2c expert, so I am learning and it is still a work in progress.
Ok, it work, I had to do bytearray(read_i2c_block_data(...)), then I got the output listing all the pmxxx levels : {'pm10 standard': ... }. Now I will see for the service and ui.
I did a basic service. I didn't find out yet how to use another service type than "temperature" and to show paths other than "/Temperature" and "/Humidity" on the venus screen. But paths like "/PM03" are published on MQTT and I can monitor the air quality on my OpenHAB instance.
Great, submit a PR, branch, whatever and I'll merge it into the codebase.
I will submit. But It hang after sometimes, I want to fix that first, and clean it up.
Link to the device description : https://www.adafruit.com/product/4632
I would like to add support for this device, I am available for coding the implementation.