It's worth trying to run espruino --list a few times, just in case. If you're using the original 1v88 firmware it doesn't send advertising packets quite quick enough, and that means that if some tools only wait a second to scan they might miss it.
You could also run espruino --list --verbose and see if any errors get reported - Noble might be trying to say that there was some error - or it's possible that NPM totally failed to install Noble at all.
You can get the battery percentage using sudo bin/espruino-cli.js -p d9:aa:73:7c:7f:cf -e "print(Puck.getBatteryPercentage())" (for example - that's my Puck's address)
At the moment there's nothing on the command-line to evaluate an expression and return just that, but you can easily strip it out:
sudo bin/espruino-cli.js -p d9:aa:73:7c:7f:cf -e "print('>>>'+Puck.getBatteryPercentage())" | sed -ne "s/^.*>>>\(.*\)$/\1/p"
However you can actually use espruino as an NPM module and can send commands and/or evaluate expressions straight in that
First step is to get it connecting to your device though.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
It's worth trying to run
espruino --list
a few times, just in case. If you're using the original 1v88 firmware it doesn't send advertising packets quite quick enough, and that means that if some tools only wait a second to scan they might miss it.You could also run
espruino --list --verbose
and see if any errors get reported - Noble might be trying to say that there was some error - or it's possible that NPM totally failed to install Noble at all.There's info covering most of what you're after on the Espruino CLI tools page I think: https://github.com/espruino/EspruinoTools
You can get the battery percentage using
sudo bin/espruino-cli.js -p d9:aa:73:7c:7f:cf -e "print(Puck.getBatteryPercentage())"
(for example - that's my Puck's address)At the moment there's nothing on the command-line to evaluate an expression and return just that, but you can easily strip it out:
However you can actually use
espruino
as an NPM module and can send commands and/or evaluate expressions straight in thatFirst step is to get it connecting to your device though.