Community
OpenEnergyMonitor

Community

Showing feed values on a Pebble (or possibly Android Wear) smartwatch

Tags: #<Tag:0x00007f6e19ca6d98> #<Tag:0x00007f6e19ca6bb8> #<Tag:0x00007f6e19ca6ac8>

Hi all

For my first post here I thought it would be nice to share something constructive rather than just coming with problems for others to solve (which will probably be my second post tbh).

I’ve managed to cobble together a quick way to display feed values on a Pebble watch, making use of the emoncms.org API to view feed values without needing to load up the site on a web browser. Useful when feeling lazy.

It makes use of Tasker installed on a paired Android phone, along with another Android/Pebble app called ‘AutoApp for Pebble’. For those who don’t know it, Tasker is a powerful, general purpose automation app for Android (it’s not available for iPhone). AutoApp for Pebble is a Pebble watch app and companion Android app that allows Tasker to work with the watch.

N.B. Since Pebble is no longer a going concern, this may become broken before too long :frowning: However, this method may extend to Android Wear devices as well, as ‘AutoApp for Wear’ is also available. I don’t have an Android Wear device to try it with, but I’d be interested to hear if anyone manages to replicate this using Wear.

We’ve used the Pebble as a quick and lazy way to check the temperature and humidity in our bedroom prior to heading up to bed: a comfortable night’s sleep for us involves having the temperature just so and the air not too dry (a vapouriser can up the humidity if needs be), but others may have their own reasons for keeping a close eye on some feed values using their watch.

Firstly, install Tasker on the phone that the Pebble is paired with, then install AutoApp for Pebble from the Pebble app store, along with it’s companion phone app from the Google Play store. AutoApp for Pebble cost about 80p or something. Tasker wasn’t free either, but it’s probably worth it for about a million other uses.

I set up a couple of Tasker profiles and associated tasks as follows:

  • New profile -> State -> Plugin -> AutoPebble -> App

  • Tap to modify the ‘Configuration’ options and tick the ‘Watch App Opened’ option.

  • Save it and opt to create a new task when prompted. This is the task that Tasker will run whenever the AutoPebble app is opened on the watch. Here we will generate a list of items to be displayed on the watch as a menu. Each item will represent one of our emoncms feeds that we want to show the last value of.

  • For the new task, add an action -> Plugin -> AutoPebble -> List.

  • Tap to edit the configuration of this action.
    ‘Header’ is the title displayed at the top of the list (e.g. ‘My Fancy Home’)
    ‘Labels’ is a comma-separated list of menu entries to display (e.g. 'Bedroom Temperature,Bedroom Humidity,Outdoor Temperature).
    ‘Actions’ is slightly more complicated in that is a comma-separated list like ‘Labels’, but each entry in the list is in the form of label=:=feedID=:=Unit (e.g. Bedroom Temperature=:=012345=:=°C,Bedroom Humidity=:=012346=:=%,Outdoor Temperature=:=012344=:=°C). The first part of each entry must match exactly to an entry in the ‘Labels’ list. The bits that follow it with =:= allow us to pass the corresponding emoncms.org feed IDs and units for use later on. Think of it as a list of arrays, with each element in an array separated by “=:=”. Your feed IDs are listed in emoncms on the feeds page.
    Set ‘Command Prefix’ to “emonFeedID” (it can actually be anything you want, we just need to use the same value when configuring the second Tasker Profile).

  • Save the task with just this one action.

  • Go back to profiles.

  • New profile -> State -> Plugin -> AutoPebble -> AutoPebble

  • Edit the configuration options and set ‘Command Filter’ to whatever you set the ‘Command Prefix’ to just now (e.g. emonFeedID).

  • Save it and opt to create a new task when prompted. This is the task that Tasker will run whenever an item is actually selected from the list using the watch. When an item is selected, the watch will send the relevant ‘action’ array we described earlier, prefixed with the command prefix that we have set (in our example, if ‘Bedroom Temperature’ was selected, the watch would send “emonFeedID=:=Bedroom Temperature=:=012345=:=°C” back to Tasker).
    This task will have two actions: one contructs the URL we need and gets the value from emoncms.org, the other displays that value on the watch.

  • Add a new action -> Net -> HTTP Get

  • In ‘Server:Port’ enter the API URL as follows (replacing APIKEY with your actual emoncms.org API key. It may be worth testing this in a web browser first with one of your feed IDs):
    https://emoncms.org/feed/value.json?id=%apcomm(2)&apikey=APIKEY
    %apcomm(2) will be replaced with the feed ID (in our example, that would be 012345 if Bedroom Temperature was selected on the watch).

  • Go back and add a second action -> Plugin -> AutoPebble -> Text Screen

  • Edit the configuration of the text screen.
    Add a ‘Title’ (e.g. “EmonCMS Feed Value”) if you want one.
    Set ‘Text’ as follows (hit enter to include line breaks if you want them). %HTTPD will be replaced with whatever was returned by the HTTP Get action:
    %apcomm(1):
    %HTTPD %apcomm(3).
    In our example, if bedroom temperature was selected on the watch, the text screen would end up saying something like:
    Bedroom Temperature:
    “18.9” °C.

If all of that is set up correctly, you should be able to open the AutoPebble app on your watch, be presented with a list of items, and shown the latest value for each when you select them.

I hope I’ve remembered all of that correctly, and that it proves useful to someone.

1 Like