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. Controllers
  3. Domoticz
  4. Detect missing/unresponsive sensor.

Detect missing/unresponsive sensor.

Scheduled Pinned Locked Moved Domoticz
12 Posts 5 Posters 1.7k Views 8 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.
  • G Offline
    G Offline
    grumpazoid
    wrote on last edited by
    #1

    I have just got up and running with the serial gateway and one motion sensor. Domoticz picked everything up first time which was a nice surprise.

    I have noticed that the sensor code is set to wake and send out a status every 2 minutes and I can see the 1's and 0's in the serial monitor. Domoticz only reports the last sensor activation and the logs just show each on and subsequent off. It does not show each 0 for every 2 minutes of inactivity.

    I am thinking along the lines of jamming detection - Is there a way for Domoticz to know if the sensor is still reporting without having to wait for the next positive activation?

    Raspberry Pi 3B - Domoticz + Node Red
    Arduino Pro Mini 3.3V - W5100 Ethernet, Nrf24
    Arduino Mega, RFLink 433Mhz
    Sonoff/ESP8266/Tasmota switches

    skywatchS 1 Reply Last reply
    0
    • G grumpazoid

      I have just got up and running with the serial gateway and one motion sensor. Domoticz picked everything up first time which was a nice surprise.

      I have noticed that the sensor code is set to wake and send out a status every 2 minutes and I can see the 1's and 0's in the serial monitor. Domoticz only reports the last sensor activation and the logs just show each on and subsequent off. It does not show each 0 for every 2 minutes of inactivity.

      I am thinking along the lines of jamming detection - Is there a way for Domoticz to know if the sensor is still reporting without having to wait for the next positive activation?

      skywatchS Offline
      skywatchS Offline
      skywatch
      wrote on last edited by
      #2

      @grumpazoid I get this a lot here. In MyController I can see the data each time it is sent. It seems that you are only seeing data when a change occurs. Perhaps there is a setting somewhere? I don't use Domoticz.

      I notice that my sensors nodes can just stop sending data. Sometimes it stops until I reboot the node, sometimes it just seems to not send for a period of time ranging from minutes to many hours and then starts sending again all by itself.

      I have tried sending heartbeat at regular intervals and then replaced heartbeat by having the node just send its status reglardless of whether or not it has changed. Neither of these approaches have worked for me. So far I have failed to get any further than this.

      If you want to detect jamming, then can I suggest a jam detection node dedicated to this task. There is more than one approach to jamming detection.

      If you are using the nrf24 modules, they are capable of frequency hopping which gives resilience to jamming to a large degree, but I don't believe this function is supported by my sensors.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nekitoss
        wrote on last edited by nekitoss
        #3

        Hi, @grumpazoid !
        Possibly sendHeartbeat(); could help you, but currently domoticz doesn't work correctly with it (without sending data).
        I've opened an issue on github, at latest beta gizmocuz make a fix, but as i tested - heartbeat will update last seen time only in devices, not in hardware. - But that if you don't send sensor data, but you are. So try it, but remeber it is beta...
        Also check last seen in hardware, not in devices. They may differ.
        You may create additional switch, and send opposite bool each time (1-0-1-0-1-0), if you want to do some scripting...
        Or just change to a switch type and create dummy alert dvice and update it via script (if switch is 1, then activate alert, and do not deactivate on switch 0)

        1 Reply Last reply
        0
        • G Offline
          G Offline
          grumpazoid
          wrote on last edited by grumpazoid
          #4

          Thanks for the above comments. This has given me some things to look into, especially the heartbeat command.

          I am wondering if MQTT could help. (I have no experience with this yet). From what I have seen MQTT can send out a LWT command if a device is not heard from.

          Raspberry Pi 3B - Domoticz + Node Red
          Arduino Pro Mini 3.3V - W5100 Ethernet, Nrf24
          Arduino Mega, RFLink 433Mhz
          Sonoff/ESP8266/Tasmota switches

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kimot
            wrote on last edited by
            #5

            Simply change your log. levels.
            If sensor is in idle state - send log.1 to Domoticz - Last Seen will be updated with each log 1 received.
            When motion detected - send log.0 - first log.0 received will trigger your action and change Last Seen time too.
            If you want detect, if sensor hags in triggered state, you can measure time interval for log 0 by LUA or DzVents script.
            If too long - take some action.

            By the way - it is problem MySesnsors part in Domoticz.
            When I am sending switch status from ESPeasy by JSON call, Last Seen time is updated with each
            received value. ON or OFF -both.

            mfalkviddM 1 Reply Last reply
            0
            • K kimot

              Simply change your log. levels.
              If sensor is in idle state - send log.1 to Domoticz - Last Seen will be updated with each log 1 received.
              When motion detected - send log.0 - first log.0 received will trigger your action and change Last Seen time too.
              If you want detect, if sensor hags in triggered state, you can measure time interval for log 0 by LUA or DzVents script.
              If too long - take some action.

              By the way - it is problem MySesnsors part in Domoticz.
              When I am sending switch status from ESPeasy by JSON call, Last Seen time is updated with each
              received value. ON or OFF -both.

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by mfalkvidd
              #6

              Earlier discussion on the same topic, where we found the root cause: https://forum.mysensors.org/post/29007
              Seems like it never got fixed though.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                kimot
                wrote on last edited by
                #7

                Quick look at Domoticz code
                MySensorsBase.cpp

                void MySensorsBase::UpdateSwitch(const _eSetType vType, const unsigned char Idx, const int SubUnit, const bool bOn, const double Level, const std::string &defaultname, const int BatLevel)
                {
                .
                .
                .
                .
                .
                .
                
                	if (!result.empty())
                	{
                		if (
                			(((vType != V_TRIPPED) || (!bOn))) &&
                			((vType != V_SCENE_OFF) && (vType != V_SCENE_ON))
                			)
                		{
                			//check if we have a change, if not do not update it
                			int nvalue = atoi(result[0][1].c_str());
                			if ((!bOn) && (nvalue == 0))
                				return;
                			if ((bOn && (nvalue != 0)))
                			{
                				//Check Level
                				int slevel = atoi(result[0][2].c_str());
                				if (slevel == level)
                					return;
                			}
                		}
                	}
                

                //check if we have a change, if not do not update it

                It says all :o(
                But interesting is, that for Log 1 value of switch it updates allways.

                G 1 Reply Last reply
                0
                • K kimot

                  Quick look at Domoticz code
                  MySensorsBase.cpp

                  void MySensorsBase::UpdateSwitch(const _eSetType vType, const unsigned char Idx, const int SubUnit, const bool bOn, const double Level, const std::string &defaultname, const int BatLevel)
                  {
                  .
                  .
                  .
                  .
                  .
                  .
                  
                  	if (!result.empty())
                  	{
                  		if (
                  			(((vType != V_TRIPPED) || (!bOn))) &&
                  			((vType != V_SCENE_OFF) && (vType != V_SCENE_ON))
                  			)
                  		{
                  			//check if we have a change, if not do not update it
                  			int nvalue = atoi(result[0][1].c_str());
                  			if ((!bOn) && (nvalue == 0))
                  				return;
                  			if ((bOn && (nvalue != 0)))
                  			{
                  				//Check Level
                  				int slevel = atoi(result[0][2].c_str());
                  				if (slevel == level)
                  					return;
                  			}
                  		}
                  	}
                  

                  //check if we have a change, if not do not update it

                  It says all :o(
                  But interesting is, that for Log 1 value of switch it updates allways.

                  G Offline
                  G Offline
                  grumpazoid
                  wrote on last edited by
                  #8

                  @kimot Thanks for this. So maybe I could comment out the if statements and then it should always update?

                  Can I just edit MySensorsBase.cpp and reboot?

                  Raspberry Pi 3B - Domoticz + Node Red
                  Arduino Pro Mini 3.3V - W5100 Ethernet, Nrf24
                  Arduino Mega, RFLink 433Mhz
                  Sonoff/ESP8266/Tasmota switches

                  mfalkviddM 1 Reply Last reply
                  0
                  • G grumpazoid

                    @kimot Thanks for this. So maybe I could comment out the if statements and then it should always update?

                    Can I just edit MySensorsBase.cpp and reboot?

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #9

                    @grumpazoid no you'll need to recompile Domoticz

                    G 1 Reply Last reply
                    0
                    • mfalkviddM mfalkvidd

                      @grumpazoid no you'll need to recompile Domoticz

                      G Offline
                      G Offline
                      grumpazoid
                      wrote on last edited by
                      #10

                      @mfalkvidd ok thanks....

                      Raspberry Pi 3B - Domoticz + Node Red
                      Arduino Pro Mini 3.3V - W5100 Ethernet, Nrf24
                      Arduino Mega, RFLink 433Mhz
                      Sonoff/ESP8266/Tasmota switches

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        grumpazoid
                        wrote on last edited by grumpazoid
                        #11

                        I have just added in the code to send battery info. Once again, domoticz only updates when the sensor is activated.

                        Edit: I have managed to get the battery updating as required by creating it's own child id. this now shows as a separate sensor in the Domoticz Utility section. It updates as per the sleep setting.

                        So for this node I currently have:
                        Motion ---- last seen = last activation
                        Battery ---- last seen = every 2 minutes.

                        Raspberry Pi 3B - Domoticz + Node Red
                        Arduino Pro Mini 3.3V - W5100 Ethernet, Nrf24
                        Arduino Mega, RFLink 433Mhz
                        Sonoff/ESP8266/Tasmota switches

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          kimot
                          wrote on last edited by
                          #12

                          Again some Domoticz code - for update battery level - it is blocked by default:

                          void MySensorsBase::UpdateNodeBatteryLevel(const int nodeID, const int Level)
                          {
                          	std::map<int, _tMySensorNode>::iterator ittNode = m_nodes.find(nodeID);
                          	if (ittNode == m_nodes.end())
                          		return; //Not found
                          	_tMySensorNode *pNode = &ittNode->second;
                          	for (auto & itt : pNode->m_childs)
                          	{
                          		itt.hasBattery = true;
                          		itt.batValue = Level;
                          
                          		//Uncomment the below to for a sensor update
                          /*
                          		for (const auto & itt2 : itt->values)
                          		{
                          			if (itt2.second.bValidValue)
                          			{
                          				_eSetType vType = itt2.first;
                          				SendSensor2Domoticz(pNode, &itt, vType);
                          			}
                          		}
                          */
                          	}
                          }
                          

                          notice - //Uncomment the below to for a sensor update

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


                          19

                          Online

                          11.7k

                          Users

                          11.2k

                          Topics

                          113.1k

                          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