<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[domoticz motion(type)sensors don't show battery level]]></title><description><![CDATA[<p dir="auto">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.<br />
any one have this problem? i can't find if its an domoticz bug or mysensors , or what what happens<br />
code is bellow but i think it's ok because if i select other type of sensor ,on domoticz, battery status work good. .thanks.</p>
<p dir="auto"><img src="/assets/uploads/files/1610619393120-06443cd0-18a3-4171-bbc8-5304ac5372cf-image.png" alt="06443cd0-18a3-4171-bbc8-5304ac5372cf-image.png" class="img-markdown  img-fluid" /></p>
<pre><code>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&lt;float&gt;(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&lt;int&gt;(((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);
}
</code></pre>
]]></description><link>https://forum.mysensors.org/topic/11529/domoticz-motion-type-sensors-don-t-show-battery-level</link><generator>RSS for Node</generator><lastBuildDate>Wed, 18 Nov 2026 04:57:39 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/11529.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Jan 2021 10:19:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to domoticz motion(type)sensors don't show battery level on Tue, 19 Jan 2021 17:48:17 GMT]]></title><description><![CDATA[<p dir="auto">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:</p>
]]></description><link>https://forum.mysensors.org/post/108852</link><guid isPermaLink="true">https://forum.mysensors.org/post/108852</guid><dc:creator><![CDATA[Tmaster]]></dc:creator><pubDate>Tue, 19 Jan 2021 17:48:17 GMT</pubDate></item><item><title><![CDATA[Reply to domoticz motion(type)sensors don't show battery level on Fri, 15 Jan 2021 16:01:27 GMT]]></title><description><![CDATA[<p dir="auto">I know what you mean.<br />
I have several Pi's.   I upgraded them from Stretch to Buster using instructions found here  <a href="https://pimylifeup.com/upgrade-raspbian-stretch-to-raspbian-buster/" rel="nofollow ugc">https://pimylifeup.com/upgrade-raspbian-stretch-to-raspbian-buster/</a></p>
<p dir="auto">I only got the courage to ugrade my domoticz server after having upgraded 3 others first with no problems.<br />
But it did work.</p>
]]></description><link>https://forum.mysensors.org/post/108795</link><guid isPermaLink="true">https://forum.mysensors.org/post/108795</guid><dc:creator><![CDATA[nagelc]]></dc:creator><pubDate>Fri, 15 Jan 2021 16:01:27 GMT</pubDate></item><item><title><![CDATA[Reply to domoticz motion(type)sensors don't show battery level on Fri, 15 Jan 2021 14:35:09 GMT]]></title><description><![CDATA[<p dir="auto">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.<br />
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 😝</p>
]]></description><link>https://forum.mysensors.org/post/108789</link><guid isPermaLink="true">https://forum.mysensors.org/post/108789</guid><dc:creator><![CDATA[Tmaster]]></dc:creator><pubDate>Fri, 15 Jan 2021 14:35:09 GMT</pubDate></item><item><title><![CDATA[Reply to domoticz motion(type)sensors don't show battery level on Fri, 15 Jan 2021 01:39:45 GMT]]></title><description><![CDATA[<p dir="auto">I have 2 motion sensors on Domoticz, and they both show the battery level.<br />
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.)<br />
Or, maybe it has to do with the Domoticz version.  My Domoticz version is 2020.2</p>
]]></description><link>https://forum.mysensors.org/post/108778</link><guid isPermaLink="true">https://forum.mysensors.org/post/108778</guid><dc:creator><![CDATA[nagelc]]></dc:creator><pubDate>Fri, 15 Jan 2021 01:39:45 GMT</pubDate></item></channel></rss>