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);
    }
    

  • Mod

    I think it is more related to the controller than mysensors. Have you tried asking in their forum?



  • Hi gohan.
    Oh, I thought it was a mysensors thing. That there's anywhere a declaration for the value name.
    I'm new in house automation and still have a lot to learn.
    I will ask in FHEM Forum. Thank you.


  • Mod

    Well, mysensors is kind of a transport of information that is then presented to the user by the controller, so it is more a user interface business to present the data the way you like :)


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.