I'm in the process of trying to implement JSON Patch as a way to cut the
chatter down between my various home automation systems. In particular,
since I've implemented a SignalR-all-the-things web interface I want to
push updates across to the browser as efficiently as possible. I also
want to make communication with mobile devices as efficient as possible.
To this end my home automation server now maintains a state for each
mobile device or browser session for all the objects that browser or
mobile connection is currently displaying. When things change it filters
the changes according to what's on the display and sends down the full
or partial objects accordingly. But now I plan to calculate a set of
JSON Patch differences and send them down as things change rather than
sending the whole object. This should dramatically reduce how much data
is being sent.
To that end I started writing an implementation of JSON Patch tonight.
The first part is concerned with calculating a patch as a difference of
two objects. Tomorrow night I'll implement the apply method that applies
a patch to an existing object.
Anyway, here's tonight's code in case anyone else wants to do this.
Why automated learning is hard for a smart home. The perils of over-fitting, under-fitting and how the general unpredictable nature of life makes it hard to build a system that learns your behavior.
In a home automation system we often want to convert a measurement into a probability. The ATAN curve is one of my favorite curves for this as it's easy to map overything onto a 0.0-1.0 range.
Several years ago we did a major remodel. I did all of the finish electrical myself and supervised all of the rough-in electrical. I also put in all of the electrical system and water in our barn. I have opinions ...