variables returns null

Post your questions and help other users.

Moderator: Martin

Post Reply
albatrosxl
Posts: 6
Joined: 01 Aug 2015 14:42
Location: Germany

variables returns null

Post by albatrosxl » 01 Aug 2015 14:50

Hi all, I tried to get the battery level and show UT via a messagebox or statusbar information. But any variable (except the date and time) returns NULL. Even if i download some examples.
Null will be returned for any variable which belonfs to battery....

Has anybody any idea?
I have a huawei y550, Android 4.3

Thanks
Albatrosxl

albatrosxl
Posts: 6
Joined: 01 Aug 2015 14:42
Location: Germany

Re: variables returns null

Post by albatrosxl » 02 Aug 2015 12:49

This happrns also in my Tablett (medion\lenivo).

What might be the Problem?
Both are not rooted.
In the other Hand, tasker, Automaten, macrodruide are able to return a correct value

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: variables returns null

Post by bogdyro » 02 Aug 2015 15:28

Hei. How are you trying to access the info? Using some variable like this? {battery_percentage,numberformat,0}
You have to use it in a flow that first initializes these values, by either using the trigger battery level or condition battery level. Otherwise they are null. There should be an acrion like init variables battery info.

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: variables returns null

Post by bogdyro » 02 Aug 2015 15:46

While you could use the cobdition in your flow and link it to the next block weather its true or false, you can also get the battery percentage with execute command
cat /sys/class/power_supply/battery/capacity

albatrosxl
Posts: 6
Joined: 01 Aug 2015 14:42
Location: Germany

Re: variables returns null

Post by albatrosxl » 03 Aug 2015 05:59

Thanks for the response.

The flow is a very simple one and has only one trigger, one action.
The trigger is "ACCU LADEZUSTAND"(battery level)
The action is "benachrichtigung auf display anzeigen"(show message on display" ) using the variable battery percentage… ..

I also tried some downloaded flows from this forum like “battery log, strom an, strom weg… . And here are the same results. All values of the variables are null (independent if i use battery level, battery health, battery percentage… )

Is it possible to upload the flow to give you more information?

Thanks,
Albatros

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: variables returns null

Post by bogdyro » 03 Aug 2015 14:13

Yes. But since i'm not having this issue it may be device dependent. I have a HTC on lollipop.
Try the execute command way

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: variables returns null

Post by Martin » 03 Aug 2015 19:08

Hi,

Maybe some typo in the variable names. Automagic is case sensitive so using Battery_percentage (upper case B) would show null.
Try to remove the action and add a condition Debug Dialog instead. The condition shows a list of all variables and the corresponding values when the flow is executed. Also ensure that the real trigger executes the flow and you do not manually execute the flow with menu->Execute/Ausführen since variables are not provided when executing manually.

Regards,
Martin

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: variables returns null

Post by bogdyro » 04 Aug 2015 03:57

For testing purposes you can add a battery level condition and a debug dialog next, then trigger the flow manually and see what comes out. Works for me on 2 devices> sony tablet and htc phone, both lollipop

albatrosxl
Posts: 6
Joined: 01 Aug 2015 14:42
Location: Germany

Re: variables returns null

Post by albatrosxl » 04 Aug 2015 15:28

Perfect. The hinter of Martin was the solution.next i will try that hinter regarding the debug Prozess.

Thumbs up

albatrosxl
Posts: 6
Joined: 01 Aug 2015 14:42
Location: Germany

Re: variables returns null

Post by albatrosxl » 04 Aug 2015 16:57

Hi, i tried now the debug mose and all variables show NULL.

Thanks agäin for your help in this

Albatrosxl

Post Reply