Change valuename send to Controller
-
Hey everybody,
I built a soil moisture sensors with the YL-39 and YL-69. I'm using FHEM as Controller. The name of the value from sensors is present as "level". I would like to rename it to "moisture level".
Can someone explain how I can change the valuename ?/* * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <MySensors.h> #define CHILD_ID 0 MyMessage msg(CHILD_ID, V_LEVEL); unsigned long SLEEP_TIME = 10000; // Sleep time between reads (in milliseconds) int lastSoilValue; // YL-39 + YL-69 humidity sensor byte humidity_sensor_pin = A1; byte humidity_sensor_vcc = 6; void presentation() { sendSketchInfo("Soil Moisture Sensor", "1.0"); present(CHILD_ID, S_MOISTURE); } void setup() { // Init the humidity sensor board pinMode(humidity_sensor_vcc, OUTPUT); digitalWrite(humidity_sensor_vcc, LOW); } int read_humidity_sensor() { digitalWrite(humidity_sensor_vcc, HIGH); delay(500); int value = analogRead(humidity_sensor_pin); digitalWrite(humidity_sensor_vcc, LOW); return 1023 - value; } void loop() { int soilValue = read_humidity_sensor(); Serial.print("Soil Moisture Level (0-1023): "); Serial.println(soilValue); //send back the values if (soilValue != lastSoilValue) { send(msg.set(soilValue, 0)); lastSoilValue = soilValue; } // delay until next measurement (msec) sleep(SLEEP_TIME); }
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login