Skip to content

Instantly share code, notes, and snippets.

@pszafer
pszafer / html5.py
Created March 25, 2019 15:05
Notify HTML
"""
HTML5 Push Messaging notification service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.html5/
"""
import datetime
import json
import logging
from functools import partial
@pszafer
pszafer / A Received from Bosch
Last active March 8, 2019 18:37
Schedule converter
[{'dayOfWeek': 'Mo', 'setpoint': 'high', 'time': 300},
{'dayOfWeek': 'Mo', 'setpoint': 'off', 'time': 720},
{'dayOfWeek': 'Mo', 'setpoint': 'high', 'time': 900},
{'dayOfWeek': 'Mo', 'setpoint': 'off', 'time': 1380},
{'dayOfWeek': 'Tu', 'setpoint': 'high', 'time': 300},
{'dayOfWeek': 'Tu', 'setpoint': 'off', 'time': 720},
{'dayOfWeek': 'Tu', 'setpoint': 'high', 'time': 930},
{'dayOfWeek': 'Tu', 'setpoint': 'off', 'time': 1380},
{'dayOfWeek': 'We', 'setpoint': 'high', 'time': 300},
{'dayOfWeek': 'We', 'setpoint': 'off', 'time': 720},
@pszafer
pszafer / rolety_setup.py
Created February 18, 2019 11:41
rolety_setup
#!/usr/bin/python3
import requests
import os
from multiprocessing import Process
def init_shutter_mode(host, openduration, closeduration):
import time
url="http://{0}/cm".format(host)
print("Starting shutter mode for {0}".format(host))
@pszafer
pszafer / rawscan.json
Last active April 5, 2019 10:16
bosch thermo output
[{
"id": "/dhwCircuits",
"type": "refEnum",
"references": [{
"id": "/dhwCircuits/dhw1",
"uri": "http://{IP}/dhwCircuits/dhw1"
}]
},
{
"id": "/dhwCircuits/dhw1",
@pszafer
pszafer / Dockerfile
Last active April 2, 2019 10:43
Dockerfile HA + Bosch thermostat
FROM alpine:3.9
EXPOSE 8123:8555
RUN apk add --no-cache git python3 py3-virtualenv openssh python3-dev gcc musl-dev libffi-dev openssl-dev
WORKDIR /usr/src/app
RUN git clone -b bosch_thermostat --single-branch https://github.com/pszafer/home-assistant
RUN git clone -b upnp_buderus_discovery https://github.com/moustic999/netdisco
RUN git clone https://github.com/moustic999/bosch-thermostat-http-client-python
RUN python3 -m venv home-assistant/
@pszafer
pszafer / HC1 buderus.json
Created February 8, 2019 13:41
HC1 buderus json
[{
'id': '/heatingCircuits/hc1/currentRoomSetpoint',
'type': 'floatValue',
'writeable': 0,
'recordable': 0,
'value': 22.0,
'unitOfMeasure': 'C',
'state': [{
'off': 0.0
}]
@pszafer
pszafer / home assistant backup.sh
Created January 22, 2019 17:22
home assistant backup
#!/bin/sh
USER="root"
PASSWORD=""
DEST="/pictures/backup"
TYPE=$1
case "$1" in
weekly)
OUTPUT="$DEST/weekly"
rm -rf $DEST/daily/*.tar.gz
@pszafer
pszafer / mqqt.py
Created November 13, 2018 10:05
Mqtt cover HASS 13112018 v1
"""
Support for MQTT cover devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover.mqtt/
"""
import logging
from typing import Optional
import voluptuous as vol
@pszafer
pszafer / epson_test_v1.py
Last active September 21, 2018 06:15
TEST Espon connection with serial asyncio
import asyncio
import serial_asyncio
class Output(asyncio.Protocol):
def connection_made(self, transport):
self.transport = transport
print('port opened', transport)
transport.serial.rts = False
transport.write(b'PWR?\r')