Open csharpWorm opened 3 years ago
you are a legend mate
@wdwithmp Get code from this branch https://github.com/csharpWorm/Alarm/tree/Setup_Moisture_Sensor to test the moisture sensor.
In alarm.ino around line 73 you should see the initialization of the moisture sensor. The 560 and 260 values are the "airValue", and "waterValue" respectively. These will need to be set to the values your sensor gives you when exposed to air and when submerged in water up to the line.
If you want to create a new arduino file for getting these test values you can use the below and just compile to the Mega,
void setup() {
Serial.begin(9600); // open serial port, set the baud rate as 9600 bps
}
void loop() {
int val;
val = analogRead(0); //connect sensor to Analog 0
Serial.println(val); //print the value to serial port
delay(100);
}
The sensor should automatically be added to Home Assistant via MQTT discovery and the value should be pased to the state topic and the value extracted using the value_template feature. Let me know if you run into any issues.
Hi Mate, awesome works like a charm. Will try to figure out the template part by reading and looking at what others have done, if I am not able to figure it out I will ask for help, this is way more than I expected
Thanks again for taking the time to help
Glad it's working for you. I didn't have a sensor to test with so wasn't quite sure if it would do what it needed to.
Hello.
Great work. I'm in a process of implementing your codes in my old alarm. One question. Is there a way to hook up a temperature sensors with your code?
Thanks
Add support for Sensors.
Thoughts are to: 1) Create a generic class that can be extended 2) over time add different sensor support unless I can figure out a more generic way to read/publish sensor data From the little research I've done on this it seems each sensor is unique in how it should be read and how the value should be converted into a human readable.