flyte / mqtt-io

Expose GPIO modules (Raspberry Pi, Beaglebone, PCF8754, PiFace2 etc.) and digital sensors (LM75 etc.) to an MQTT server for remote control and monitoring.
MIT License
470 stars 159 forks source link

Add support for DFR0300 EC sensor #397

Closed linucks closed 2 months ago

linucks commented 3 months ago

This adds support for the DFRobot EC sensor.

In order to give an accurate reading, the EC sensor requires the current temperature. This PR also adds the EventBus argument to the setup_sensor function, so that sensors can query the event bus and read the value of other sensors. This has required changing the setup_sensor call for all sensors.

For the sensor to function properly, it needs to be plugged into an ADC. The DFRobot DRF0566 HAT has the correct connectors and an integral ADC, so this PR includes the addition of the code for the HAT and the ADC in the mqtt_io/modules/sensor/drivers folder. This is added separately so that it can be used by other sensors as there are many sensors from DFRobot that could be added trivially using this driver.