Skip to content

Instantly share code, notes, and snippets.


Otto Winter OttoWinter

View GitHub Profile
View esp06.yaml
# esp06: Yet unused Sonoff POW R2
# This ESPHome code is used on a Sonoff POW R2.
# It is used to detect if my Dryer is running.
# It exposes a lot of information, including an
# additional binary sensor. This allows easy
# automations from Home Assistant.
View Dockerfile
# Copy data for add-on
RUN chmod a+x /
CMD [ "/" ]
OttoWinter /
Last active Oct 4, 2018
Cron Next Matcher
from datetime import datetime, timedelta
import pytz
tz = pytz.timezone('Europe/Vienna')
def _lower_bound(cmp, arr):
# Return the first value in arr greater or equal to cmp
# Return None if no such value exists
# If arr were sorted, this could of course be done in log(n)
return next((x for x in arr if x >= cmp), None)
OttoWinter /
Last active May 19, 2019
Lovelace Migration Script

Home Assistant Lovelace Migrator

Do you want to try out this experimental (!) new lovelace UI stuff in Home Assistant but don't want to migrate your entire configuration? This script is here to help! It reads in your Home Assistant configuration (specifically the group: section) and creates a matching ui-lovelace.yaml file in your Home Assistant configuration folder (of course backing up any previous file at that path).

To use this script, you first need to have python and home assistant installed where you plan to run this script. Do so using virtual environments and the pip3 install -U homeassistant command. Then copy below file to (any location should work) and run:

View main.cpp
#include "esphomelib/application.h"
#include <WiFi.h>
#include <ESP8266WiFi.h>
using namespace esphomelib;
View main.cpp
#define NUM_LEDS 60
class FastLEDLightOutput : public Component, public LightOutput {
FastLEDLightOutput() {
// supports brightness and RGB
traits_ = LightTraits(true, true, false);
const LightTraits &get_traits() const override {
Support for Konnected devices.
For more details about this component, please refer to the documentation at
import logging
import hmac
import voluptuous as vol
OttoWinter /
Last active Feb 7, 2018
Grouped Lights

Grouped Lights

Based off of the excellent work over at

This component allows lights to be grouped together and supports all of Home Assistant's features such as effects and color temperatures. The "child" lights can still be used as normal though as this component just forwards all calls to all of the children and uses the first active child light for the group state.

In order to use this, first copy the attached code to a file custom_components/light/ in your configuration folder. Then, specify all of your grouped lights like this:

You can’t perform that action at this time.