Posts

How to trigger Alexa routines from Home Assistant

Since version 0.85, the Home Assistant's Alexa component supports proactive reporting of devices' states to Alexa. What this means is that when a device's state changes, Home Assistant will let Alexa know of that change. Previously, Alexa would only query devices states when you look at them on the Alexa app, or when you asked Alexa about a device.

While at first this doesn't look like something very useful, it opens up a new possibility: allowing Home Assistant to trigger Alexa's routines! With a routine you can make Alexa say something, play the Flash Briefing, tell the weather, change the volume of the Echos, and some more other actions that are supported by routines!

So, how can you do this? Its pretty simple, actually. First, make sure you've setup the SmartHome Alexa Component to allow proactive reporting (make sure you have endpoint and client_id/client_secret specified). Next you just need to expose a binary sensor (it can be a normal door sensor, or ev…

Simple thermostat scheduler in Home Assistant

Image
Ever since I moved, I wanted to replace my dumb heating thermostat with Home Assistant, because I would like to be able to turn the heating off when I go away for a few days, but mainly because it would be nice to be able to turn it on a few hours before coming back home.
So, eventually I placed a few Xiaomi temperature sensors around the house, replaced the thermostat with a wifi relay, combined it all together with the Generic Thermostat component, but one important thing was missing: a way to schedule when the temperature should be set to high (comfort mode) or low (eco mode). In my dumb thermostat I was able to set an hourly schedule for each day of the week, since I don't want the heating to be running 24/7. Unfortunately, there is no component to do this in Home Assistant, but since we do have the Python Scripts component, I decided to write a simple Python script to handle my scheduling, along with a simple automation that runs it every 10 minutes:
At the beginning of the…

Misadventures in Shaderland: the jumping uniform array element

I work on OpenGL ES for an Android and iOS app, and from time to time a weird glitch shows up on a specific device (or a set of devices with the same GPU series). This was one of those times.

So, I was writing a new GLSL shader and all was going well. This shader has a uniform array as input, that is used to move the vertices dynamically along a polyline, without the need to reload geometry:
#define POLYLINE_SIZE 16 uniform highp vec2 u_polyline[POLYLINE_SIZE];
Then, the vertex shader is doing the following to interpolate a position between two points of the polyline:
vec2 pt1 = u_polyline[int(idx)]; vec2 pt2 = u_polyline[int(idx)+1]; vec2 pos = pt1 + (pt2 - pt1) * idx_diff;
That worked correctly, and the vertices were moving smoothly along the polyline, based on some data that is specific to each vertex. That was until I tested the app on a Nexus 7 (2nd Gen). On that device, which has an Adreno 320 GPU, vertex positions seemed to be a displaced. After checking every…

Home Assistant: Notify when a light was left on and no one is at home

I'm using Home Asisstant for about a year now, and this is one of those things that I wanted to add for a long time, but have been postponing it. Until a few days ago, when I've arrived home and found out that one of the lights was on all day. Actually, after checking the Home Assistant log, it was my cat that triggered a motion sensor, that turned the light on (more about cats and motion sensors in a future post).
The basic idea here is that if I'm not at home for more than 30 minutes and a light is on (or turns on), I get a notification on my phone. For sending notifications from Home Assistant to my phone, I'm using the Pushbullet component.
I already had a group were I list all the controllable lights in the house and I wanted to be able to use this group directly in the automation, so I don't have to define every light in two separate places. Also, I want to be able to exclude some lights from triggering a notification (but I don't want to remove them fro…