domoticz motion(type)sensors don't show battery level



  • hello. i build an motion sensors that works great but if i select sensor type on domoticz like "motion sensor", the battery level from "devices" disappear. That only happens on "motion sensor type", if i select other like on/off type ,the level appears but than i can't use the "disable after x seconds" feature present only on motion sensor type.
    any one have this problem? i can't find if its an domoticz bug or mysensors , or what what happens
    code is bellow but i think it's ok because if i select other type of sensor ,on domoticz, battery status work good. .thanks.

    06443cd0-18a3-4171-bbc8-5304ac5372cf-image.png

    void setup()
    {
    	pinMode(DI_SENSOR1, INPUT);
    	//pinMode(DI_SENSOR2, INPUT); // sets the motion sensor digital pin as input
      analogReference(INTERNAL);
    }
    
    void presentation()
    {
    	// Send the sketch version information to the gateway and Controller
    	sendSketchInfo("Motion Sensor", "1.0");
    
    	// Register all sensors to gw (they will be created as child devices)
    	present(CHILD_ID, S_MOTION);
    }
    void loop()
    {
      int sensorValue = analogRead(BATTERY_SENSE_PIN);
     float vBat  = static_cast<float>(sensorValue * (8.2/1023));
      
      #ifdef MY_DEBUG
        Serial.print("A0: ");
        Serial.println(sensorValue);
        Serial.print("Battery Voltage: ");
        Serial.println(vBat);
      #endif
        delay(500);
        int batteryPcnt =  static_cast<int>(((vBat-6)/(8.4-6))*100.);
        delay(500);
    
      // ((1e3+150)/150)*1.1 = Vmax = 8.43 Volts
       // 8.43/1023 = Volts per bit = ~0.00804
    
      #ifdef MY_DEBUG
           Serial.print("Battery percent: ");
        Serial.print(batteryPcnt);
        Serial.println(" %");
      #endif
       if (oldBatteryPcnt != batteryPcnt)  {
            // Power up radio after sleep
            
            sendBatteryLevel(batteryPcnt);
            oldBatteryPcnt = batteryPcnt;
            }
    
     //motion 
    
        bool tripped = digitalRead(DI_SENSOR1) == HIGH;
    
    
          Serial.println(tripped);
         send(msg.set(tripped?"1":"0"));
    
        sleep(digitalPinToInterrupt(DI_SENSOR1), RISING, 0);
    }
    


  • I have 2 motion sensors on Domoticz, and they both show the battery level.
    Maybe it is because your level doesn't get sent often enough. I do send a battery level every 30 minutes even if the value hasn't changed (which is way too often. But, I am still experimenting with these nodes.)
    Or, maybe it has to do with the Domoticz version. My Domoticz version is 2020.2



  • My version it's V4.11207 .I can't upgrade more without upgrade Os from "strecht"to new raspbian Os. Shouldn't be the sensor update frequency because if i go to domoticz now and just change sensor type to" on/off switch" ,battery level just appears there on debices.
    I think that i have to upgrade everyting...Os and domoticz but its a pain,because i have to pair zwave devices from shutters again...and probably new bugs appear.... My thought is;linux that work...don't touch 😝



  • I know what you mean.
    I have several Pi's. I upgraded them from Stretch to Buster using instructions found here https://pimylifeup.com/upgrade-raspbian-stretch-to-raspbian-buster/

    I only got the courage to ugrade my domoticz server after having upgraded 3 others first with no problems.
    But it did work.



  • On a new card i updated OS to Raspian Buster and installed latest domoticz V 2.2020. BUT the problem still the same . no battery value present soon as this sensor report a new "data" AND it's as motion sensor and not as any other type of sensor. If it works to others i really don't understand what happens...😖


Log in to reply
 

Suggested Topics

  • 5
  • 5
  • 1
  • 1
  • 2
  • 1

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts