Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Change valuename send to Controller

Change valuename send to Controller

Scheduled Pinned Locked Moved Development
4 Posts 2 Posters 918 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • WieselW Offline
    WieselW Offline
    Wiesel
    wrote on last edited by
    #1

    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);
    }
    
    1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • WieselW Offline
        WieselW Offline
        Wiesel
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • gohanG Offline
          gohanG Offline
          gohan
          Mod
          wrote on last edited by
          #4

          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 :)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          20

          Online

          11.7k

          Users

          11.2k

          Topics

          113.0k

          Posts


          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • MySensors
          • OpenHardware.io
          • Categories
          • Recent
          • Tags
          • Popular