Page 1 of 1

how do you include a water level sensor device in rainmaker?

Posted: Fri Mar 08, 2024 1:22 pm
by chopinskiii
i mean, reading temperature and humidity values from a dht11 sensor is fairly easy since you can just declare:

Code: Select all

TemperatureSensor temperature("Temperature");
TemperatureSensor humidity("Humidity");
but i also want to read values from my water level sensor and this is where i get stumped. i've checked the rainmaker documentation numerous times already but there is no specific type for adding this kind of device:

Code: Select all

Standard Devices

Classes are defined for the standard devices.

Creating object of these class creates the standard device with default parameters to it.

Class for standard devices

Switch

LightBulb

TemperatureSensor

Fan
or yknow, maybe i'm just missing something? how can i include the water level sensor to my rainmaker app? any help is much appreciated 🙏

Re: how do you include a water level sensor device in rainmaker?

Posted: Wed Mar 13, 2024 11:59 am
by ESP_Piyush
Water level sensor is not a standard device/parameter, so you will have to create custom ones

Eg.
custom device:
my_device = new Device("Water Sensor", "my.device.water-sensor", NULL);

custom param:
Eg. Param sensor("Level", "my.param.water-level", value(0), PROP_FLAG_READ);

Add custom param to the custom device
my_device->addParam(sensor);

You can check out some related conversations here.