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. domoticz motion(type)sensors don't show battery level

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

Scheduled Pinned Locked Moved Domoticz
5 Posts 2 Posters 71 Views 1 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.
  • TmasterT Offline
    TmasterT Offline
    Tmaster
    wrote on last edited by Tmaster
    #1

    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'm a arduino fan .Even sometimes don't undestanding how to use it :P

    1 Reply Last reply
    0
    • nagelcN Offline
      nagelcN Offline
      nagelc
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • TmasterT Offline
        TmasterT Offline
        Tmaster
        wrote on last edited by Tmaster
        #3

        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'm a arduino fan .Even sometimes don't undestanding how to use it :P

        1 Reply Last reply
        0
        • nagelcN Offline
          nagelcN Offline
          nagelc
          wrote on last edited by nagelc
          #4

          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.

          1 Reply Last reply
          0
          • TmasterT Offline
            TmasterT Offline
            Tmaster
            wrote on last edited by
            #5

            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...:confounded:

            i'm a arduino fan .Even sometimes don't undestanding how to use it :P

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


            17

            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