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. Troubleshooting
  3. Suddenly a Sensor is Missing, not the whole Node. (RPI Eth Gateway, HA)

Suddenly a Sensor is Missing, not the whole Node. (RPI Eth Gateway, HA)

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 2 Posters 1.2k 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.
  • S Offline
    S Offline
    se-O-matic
    wrote on last edited by
    #1

    Hi,
    i'm running a sensor network for a couple of years without problems. The setup is described below.
    Some days ago i build an other sensor node and now suddenly a random sensor is missing a view days after HomeAssistant restart.
    So, after a restart everything works perfect. But after a view days the temperature reading of one node, not always the same node, didnt work. The values for humidity and battery level still work from this node. After a restart of the Pi everything works again.
    One time I didnt restart for a couple of days, even more temperature sensors failed. And again the humidity readings still work. After a restart everything works again.

    My network:
    A Raspberry Pi 3 with 64 Bit Raspbian. Homeassistant running in Docker.
    A RFM69 rf module is connected to the GPIO of the RPI to run a ethernet gateway. I had to recompile it because of the 64 Bit structure.
    I have several sensors based of an arduino structure and the RFM69 modules:

    • 3 Temperature/Humidity PLUS ONE NEW Temp/Hum sensor
    • 1 Temp/Hum/Light sensor
    • 1 USB charger sensor (report two current values, if switched on)
    • 1 power meter sensor (actually offline to rewrite the code for an new power meter with different protocol)

    Additionally a couple of actuators and switches over zigbee (SonOff USB stick), like curtains and wall plugs.
    And one BTLE temp/hum sensor.


    Now I 'm a little helpless where to start the debugging. I think the problem occurs between the mysensors gateway and HomeAssistant.
    Is this a space problem for storing the data?
    Maybe I can switch to a more convenient setup, like an mysensors USB gateway and the HASS-OS from HomeAssistant instead of the "experimental" docker stuff?

    I hope someone has a good idea to help.

    Thanks!
    se-O-matic

    1 Reply Last reply
    0
    • E Offline
      E Offline
      eiten
      wrote on last edited by
      #2

      Hi @se-O-matic

      can you please post your source code of the node in question?
      You only restarted Home Assistant, not the nodes, correct?

      Thanks and regards, Edi

      1 Reply Last reply
      0
      • S Offline
        S Offline
        se-O-matic
        wrote on last edited by
        #3

        Hi,
        thanks for the reply.
        Yes, a restart of the raspberry is enough.

        This is the code of the temperatur sensors:

        /*
         * My Sensors Node for temperature and humidity
         * 
         * Hardware: MSN R00
         * BME280 (temp, hum) at I2C
         * 
         * Runs at 2 x AA batterys
         * 
         */
        
        // RFM69CW at 433 MHz / Raspebrry Pi as ethernet gateway
        #define MY_RADIO_RFM69
        #define MY_RFM69_NEW_DRIVER
        #define MY_RFM69_FREQUENCY RFM69_433MHZ 
        #include <MySensors.h>
        
        // BME280 library from Adafruit, need the Adafruit "Unified Sensor library", too
        #include <Adafruit_BME280.h>
        
        // Define child IDs and messages
        #define CHILD_ID_TEMP  0
        #define CHILD_ID_HUM   1
        MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
        MyMessage msgHum(CHILD_ID_HUM, V_HUM);
        
        // Define strings, which are send to the controller
        #define SKETCHSTR "Temp Humidity Sensor"
        #define SKETCHVER "1.0"
        
        // Sleep time for sensor 
        uint32_t SLEEP_TIME = 300000;    // sleep time between reads (seconds * 1000 milliseconds)
        
        // Constructor for sensor
        Adafruit_BME280 bme;
        #define BME280_TEMP_OFFSET -1.0    // calibration ofsset for the temperature
        
        // Battery stuff
        #define EMPTY 536         // Brown Out ATMega   //536 equal to 1.8 V
        #define SCALE 0.2415      // (100/950-EMPTY)    //950 equal to 3.2 V
        int BATTERY_SENSE_PIN = A0;   // select the input pin for the battery sense point
        int batteryPcnt = 0, oldBatteryPcnt = 0;
        
        // Global variables for sensor values
        float temp = 25.0, hum = 50.0;
        float temp_last = 0.0, hum_last = 0.0;
        
        // Helper for calculate battery percentage
        int calc_pcnt(int value){
          int batteryPcnt = ((value - EMPTY) * SCALE);
          batteryPcnt = (batteryPcnt > 100) ? 100 : batteryPcnt;
          batteryPcnt = (batteryPcnt < 0) ? 0 : batteryPcnt;
          return batteryPcnt;
        }
        
        void setup() {
          // use the 1.1 V internal reference
          analogReference(INTERNAL);
        
          //BME280 stuff
          bme.begin(0x77);
          bme.setSampling(Adafruit_BME280::MODE_FORCED,
                          Adafruit_BME280::SAMPLING_X1,   // temperature
                          Adafruit_BME280::SAMPLING_NONE, // pressure
                          Adafruit_BME280::SAMPLING_X1,   // humidity
                          Adafruit_BME280::FILTER_OFF );
        
          oldBatteryPcnt = calc_pcnt(analogRead(BATTERY_SENSE_PIN));
        }
        
        void presentation()
        {
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo(SKETCHSTR, SKETCHVER);
         
          present(CHILD_ID_TEMP, S_TEMP, "Temperature");
          present(CHILD_ID_HUM, S_HUM, "Humidity");
        }
        
        void loop() {
          //read temp and hum and lux
          bme.takeForcedMeasurement();
          temp = bme.readTemperature();
          temp = temp + BME280_TEMP_OFFSET;
          hum = bme.readHumidity();
        
          if(temp != temp_last){
            send(msgTemp.set(temp, 2));
            temp_last = temp;
          }
          if(hum != hum_last){
            send(msgHum.set(hum, 2));
            hum_last = hum;
          }
        
          // send the battery level
          batteryPcnt = calc_pcnt(analogRead(BATTERY_SENSE_PIN));
          if (batteryPcnt < oldBatteryPcnt) {
              sendBatteryLevel(batteryPcnt);
              oldBatteryPcnt = batteryPcnt;
          }
         
          sleep(SLEEP_TIME);
        }
        

        It's also hosted on github: https://github.com/se-o-matic/msn/blob/master/Software/msn_BME280/msn_BME280.ino

        Thanks!

        1 Reply Last reply
        0
        • E Offline
          E Offline
          eiten
          wrote on last edited by
          #4

          Sorry @se-O-matic , but I can't see any problem. Does the temperature recover with time? I only can imagine that you have a collision on air.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            se-O-matic
            wrote on last edited by
            #5

            No, it does not recover.

            The Problem is not easy to debug. I now want to build a serial gateway. With that, I am more flexible to test. Maybe to run MySensors on a second raspberry pi with a standard Home Assistant HASS-Os image. Or I check the MySensors network with MyController.
            At this moment i run the whole system on 64 Bit raspbian, with HA in docker, which is a little bit experimental and i had to fix some lines in the ethernet gateway to compile it for 64 bit. So this is experimental, too.

            1 Reply Last reply
            0

            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
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            17

            Online

            12.0k

            Users

            11.2k

            Topics

            113.4k

            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