-
Notifications
You must be signed in to change notification settings - Fork 1
Implementing new sensors
There are pre-made abstract classes that define the required interfaces
Place actual implementation in picure/picure/Backend/io/implementations
Use this as super class picure.Backend.io.prototypes.proto_sensor.SensorProto
Please include external libraries inside setup.py to keep the project installable.
picure.Backend.io.prototypes.base.Base
and picure.Backend.io.prototypes.proto_sensor
provide you with two properties:
-
name
: Stores the name of the sensor (i.e.: SENSOR_TEMP) -
sensor
: Stores the reference to the library / implementation to read data
The class hardware_controller.py
will instantiate the classes via the abstraction layer provided inside sensor.py
. Make sure to add your implementation in the __new__()
function. You can now alter your config.yaml
to direct hardware_controller.py
instantiate your sensor type via the property SENSOR_TYPE:
.
The SensorProto
abstract class will require at least a get() function to be implemented. Please return the sanitized sensor values as float.
You have to provide the implementation for your get
function to return a metric value. You may also add the suffix _imperial
to an additional implementation to output imperial values. Please make sure that your suffix is unambiguous and one can clearly differentiate US imperial and GB imperial values.
PiCure operates 230/120V main circuits. Do not attempt anything without proper training AND certification. Please make yourself familiar with local regulations and if required contact an electrician. This project can be a fire and safety hazard, may cause bodily harm, injuries and or death if improperly installed!
PROCEDE WITH THE UTMOST CAUTION
This does not alter the conditions of the projects license in any way, shape or form so please read them too.