QuantumEntangledAndy / neolink

An RTSP bridge to Reolink IP cameras
GNU Affero General Public License v3.0
297 stars 44 forks source link

Battery information #54

Closed fmarzocca closed 11 months ago

fmarzocca commented 1 year ago

The "battery level" feature is very useful, but it introduces a problem. If the battery is enabled and I query the camera status, I have an output like this:

==Battery==
Charge: 100%,
Temperature: 15°C,
LowPower: false,
Adapter: solarPanel,
ChargeStatus: charging,

<?xml version="1.0" encoding="utf-8"?><RfAlarmCfg version="1.1"><rfID>0</rfID><enable>1</enable><sensitivity>0</sensitivity><sensiValue>16</sensiValue><reduceFalseAlarm>0</reduceFalseAlarm><timeBlockList /><alarmHandle /></RfAlarmCfg>

which is tricky to decode as it is mixed text/XML format.

or this:

<?xml version="1.0" encoding="utf-8"?><BatteryInfo><channelId>0</channelId><chargeStatus>charging</chargeStatus><adapterStatus>solarPanel</adapterStatus><voltage>4019</voltage><current>-180</current><temperature>15</temperature><batteryPercent>100</batteryPercent><lowPower>0</lowPower><batteryVersion>2</batteryVersion></BatteryInfo>
<?xml version="1.0" encoding="utf-8"?><RfAlarmCfg version="1.1"><rfID>0</rfID><enable>1</enable><sensitivity>0</sensitivity><sensiValue>16</sensiValue><reduceFalseAlarm>0</reduceFalseAlarm><timeBlockList /><alarmHandle /></RfAlarmCfg>

which are 2 separate XML and introduces more process to decode.

My suggestions are:

  1. add a separate command to query the battery or
  2. add the battery information in the same XML (just one XML output)
QuantumEntangledAndy commented 1 year ago

Ahhh, tricky one. What is happening is that the camera is sending events to us and we are reacting to those events. So collecting them into one xml is a bit tricky.

I suppose the easiest method would be to disable the battery event during PIR and add a battery command too

If I could add yaml it might work too because it would probably print like this

battery:
  voltage: 1000
  # etc
pir:
  enable: 1
  # etc
fmarzocca commented 1 year ago

That would sound good. I have no problem in decoding XML. You can leave the battery info in XML, as long as it is on a separate command.

fmarzocca commented 1 year ago

You can put this on "low priority" or close. I have managed with Node Red to simply decode the 2 XMLs in a row.

QuantumEntangledAndy commented 1 year ago

I plan to get around to this after I've done my gstreamer and pause fixes. Those are more critical to address

QuantumEntangledAndy commented 11 months ago

Closing this since we now have the battery command