Node-Red on android phone advise

Hi All,
If anyone has a play with the termux api, would appreciate some advise on NR on android platform. Installed NR on android phone and pleasantly surprised at how fast and easy the installation was, seem to be much quicker than on a pi3. Also installed termux api node.

I cant seems to get the termux api node to work as there is not much documentation on the subject.

image

Debug msg reported ""SyntaxError: Unexpected end of JSON input"

There is no setting on the battery status node.

[{"id":"32cbb2f0.f8dac6","type":"debug","z":"7f25bb31.4a6e8c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":414.571533203125,"y":62.71427917480469,"wires":[]},{"id":"46fb3e0c.5b5ae","type":"inject","z":"7f25bb31.4a6e8c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":147,"y":65.71427917480469,"wires":[["7fe18df4.3c4b84"]]},{"id":"7fe18df4.3c4b84","type":"termux-battery-status","z":"7f25bb31.4a6e8c","name":"","topic":"","x":277.14280700683594,"y":131,"wires":[["32cbb2f0.f8dac6"]]}]

Seems that the node expect some specific json format?

Thanks,
Ken

Well, a quick scan of the code on github shows that this node is just using exec to run the termux-battery-status command, and parses the resulting string as JSON.

It also looks like the code is almost 2 years old -- so my guess is that either the underlying termux command output has changed, or the exec command is not working correctly. Probably best to raise an issue on the code in its github repo, and hope the author is still active.

Hi @shrickus, thanks for that clue, indeed the node seem to make an exec call and pass the result back as a json object.

Looks like I have to install two more files, first install termux api in playstore (which I did), but I did not install pkg install termux-api in the terminal and that seems to be the issue as I wrongly assume that by installing termux api in playstore will take care of everything.

Also you are spot on about outdated commands, as some of the command have changed, for example "sms in" has changed to "sms list".

This is opening a whole array of sensors one could use, great!

Thanks

1 Like