Please let me know if I am not using the right terms below; I’ve been reading a lot of the HA documentation and trying to make sense of the different terms (sensor, component, entity, platform, integration, etc.).
My goal is to create a new sensor that measures a water tank level
. A simple version of the sensor consists of four digital inputs. Each input indicates a water level in the tank (level 1, 2, 3, 4
).
Now, in a Raspberry Pi, each level is a digital input (gpio
), and I am not sure how to create such sensor so it is compatible with HA Architecture.
I am not sure what HA elements should I create. It looks like I have to create either:
- A component (because this is a new type of sensor?)
- An sensor entity (deriving from another Sensor Entity?)
- A platform?
I think this link on Sensor Entities should be one of the first steps: create my sensor as a new python class that inherits from a sensor type that already exists. The problem is that I see Sensor Entities
for battery level, power, humidity, illuminance, etc., but non of the Sensor Entities
in the list are about “water level” or similar, so not sure where I should start.
Disclaimer: please note I’ve seen examples of how to use the binary_sensor + rpi_gpio platform yaml configuration to create 4 binary sensors. Although this could be a hacky solution (integration?), I don’t want to do it that way, because HA would see those as 4 separate sensors and in my case, I want HA to treat my sensor as one unit (component? Sensor? Entity?) which will report a level between 0 and 4 (I could also represent levels from 0% to 100%, but that is a trivial future change).
Thank you for your time!