Hi there,
I wanted to share a a method I used to create an Android widget that shows me the state of my things at home with real time updates.
This is something I cooked up recently, it’s rather rough but it does the job.
The screenshot above actually shows 5 widgets grouped together. The ones of interest here are the two columns of values.
Here’s how it works:
I have a smart app that takes a number of devices I want to monitor. In my case, I monitor doors, locks, lights and presence.
When the state of any of my devices changes, I use Pushbullet service to send a push notification to my Android phone. That push notification contains a JSON string that represents the state of my home.
The JSON string looks something like this:
{"closed":"Front Door","locked":"all","mode":"Home","notPresent":"Mrs","off":"all","on":"none","open":"Garage Door","present":"Mr","unlocked":"none","updated":"12:07 PM"}
This push notification is intercepted and dismissed by Tasker. It’s content is parsed in JavaScript and it passes Tasker variables to Minimalistic Text: Widgets. Then the widget displays the values on the screen.
Easy!
The app is designed in such a way that it would not send a push notification for events that cancel each other out within one minute. If nothing happens in 15 minutes, the state will be refreshed and pushed to keep things in check. There is no polling from the phone, which is good for data usage and battery life.
Here’s the app:
https://github.com/625alex/SmartThings/blob/master/apps/StateOfTheWorld.groovy
Here’s the Pushbullet device type that is used by the app:
I hope this inspires someone to make something interesting.
If someone is interested in actually installing and using this, let me know!