Hello:)
Does somebody tryied reading battery status from phone or tablet ?
I want to use old tablet for lcd screen but it will be not offen use and for safety i don't want to have still battery charger connected to it.
My idea is to read every 5min battery status and when it will be less than 20% using relay turn on wall charger and disconnect when be 100%
Android battery level over mqtt in espeasy.
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 30
- Joined: 09 Apr 2017, 23:27
Re: Android battery level over mqtt in espeasy.
There are a few things to consider here:
- MQTT is a push protocol, so the measured value has to be pushed to a broker to be visible for others. So you can't pull that info by using MQTT.
- Moving the control to an external device, like an ESP unit, might create an undesirable triangle-dependency, maybe it should be more simple
I've used a somewhat different approach:
- Install the Android app Automate (free version with some limitations available, but enough for this purpose)
- Create a flow that checks the battery level, and when below the desired level (20%) send a command (http://ip.of.your.esp/control?cmd=event,poweron) to an ESPEasy-powered Sonoff S20 power plug (other brands/models can also be used, of course) to switch on, then wait for 10 minutes and loop
- Create another flow that checks for battery level 100%, and when reached, wait for an extra hour, the send a command (http://ip.of.your.esp/control?cmd=event,poweroff) to the the plug. Then wait for 10 minutes and loop.
Of course, the events poweron and poweroff have to be added as rules in the ESPEasy unit:
Works like a charm
- MQTT is a push protocol, so the measured value has to be pushed to a broker to be visible for others. So you can't pull that info by using MQTT.
- Moving the control to an external device, like an ESP unit, might create an undesirable triangle-dependency, maybe it should be more simple
I've used a somewhat different approach:
- Install the Android app Automate (free version with some limitations available, but enough for this purpose)
- Create a flow that checks the battery level, and when below the desired level (20%) send a command (http://ip.of.your.esp/control?cmd=event,poweron) to an ESPEasy-powered Sonoff S20 power plug (other brands/models can also be used, of course) to switch on, then wait for 10 minutes and loop
- Create another flow that checks for battery level 100%, and when reached, wait for an extra hour, the send a command (http://ip.of.your.esp/control?cmd=event,poweroff) to the the plug. Then wait for 10 minutes and loop.
Of course, the events poweron and poweroff have to be added as rules in the ESPEasy unit:
Code: Select all
on PowerOn do
gpio,12,1
endon
on PowerOff do
gpio,12,0
endon
/Ton (PayPal.me)
-
- Normal user
- Posts: 30
- Joined: 09 Apr 2017, 23:27
Re: Android battery level over mqtt in espeasy.
Thank You for reply, thank You Very much!
I will try in free moment of time.
I will try in free moment of time.
Who is online
Users browsing this forum: No registered users and 31 guests