Adding "witness rank" into iOS Home App
I've been investing in smart home appliances lately. So far, I've managed to cover %90 of the lightning with Hue light bulbs and Hue smart outlets.
Heating is connected to Tado. And of course, I've implemented motion sensors everywhere that automate lightning and notifications in some cases.
If you're into smart homes and if you don't do everything in the "Do it Yourself" way, then you need to choose a path. Since the IoT on homes is considerably new, there is no accepted standard.
Amazon, Google, Apple, Samsung, and other companies don't agree n a standard framework that you need to deal with integration problems if you don't buy your items carefully.
I've chosen the Homekit since I love using Apple products. (It's a love-hate relationship, though) If you choose the Homekit path, then your main "command center" app is the iOs Home app.
Lately, my witness rankings floating in and out around top20, so I've made a quick virtual sensor, and successfully put it to the home app.
|Dashboard View (Favorites)||Steem(Virtual Room detail)|
Install Homebridge and identify it as a new bridge on your Home app.
Install Homebridge HTTP Temperature Sensor.
Deploy this Python service into your Raspberry PI.
from lightsteem.client import Client from flask import Flask, request app = Flask(__name__) def get_position(witness): """ Returns the ranking of a specific witness If only the witness is inside top100. """ c = Client() top_100 = c.get_witnesses_by_vote("", 100) for index, _witness in enumerate(top_100): if _witness["owner"] == witness: return index + 1 return 0 @app.route("/api/witness-position/") def witness_position(): if not request.args.get("witness"): return "Use it like ?witness=<witness_name>" return str(get_position(request.args.get("witness"))) if __name__ == "__main__": app.run()
Add an accessory to the Homebridge sensor with your Python service URL.
After restarting Homebridge, You'll see the sensor.
Of course, Homekit doesn't have an accessory type for that kind of thing, so we're mimicking a temperature sensor, expect to see things related to temperature. :)
Mimicking a smart outlet at Home app might be cooler since it actually can be a functional widget to disable witness on emergencies. (E.G: You're surfing some part of South Asia and you needed to disable your witness as an emergency, just ask Siri to do it.)
Vote for my witness
Witness rankings between 15-25 is more challenging now. As a new consensus witness, I need your vote to secure my position so that I don't check the ranking in every minute! :)