Skip to content

Instantly share code, notes, and snippets.

Avatar

Fredrik Erlandsson fredrike

View GitHub Profile
View car_heater.yaml
blueprint:
name: Car heater
description: Activate car heater based on sensor temperature
domain: automation
input:
temp_sensor:
name: Reference temperature sensor
selector:
entity:
domain: sensor
View voc_charging_notification.yaml
blueprint:
name: Notify when car is charging
description: Send push notification when the car is plugged in and have started charging
domain: automation
input:
battery_charging:
name: Car battery charging sensor
selector:
entity:
domain: binary_sensor
View InitiatlizeCovid19data.py
## Import Libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
#%matplotlib inline
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
View hassio.sh
#!/bin/sh
CONFIG_FILE="/usr/local/hassio/etc/hassio.json"
fix_usb_devices() {
USB_FILE="${HASSIO_DATA}/usb_devices.txt"
docker cp hassio_supervisor:/lib/udev/rules.d/60-serial.rules /lib/udev/rules.d/60-serial-hassio.rules
docker cp hassio_supervisor:/lib/udev/rules.d/60-input-id.rules /lib/udev/rules.d/60-input-id-hassio.rules
View fix_usb_devices.sh
#!/bin/sh
fix_usb_devices() {
RULES_FILE="/lib/udev/rules.d/59-usb-hassio.rules"
RULES_FILE="/dev/stdout"
HASSIO_DATA="$(jq --raw-output '.data // "/usr/share/hassio"' ${CONFIG_FILE})"
USB_FILE="usb_devices.txt"
# Clear entris from file
@fredrike
fredrike / generate-client.sh
Created Aug 15, 2019 — forked from Belphemur/generate-client.sh
Generate a new client configuration for WireGuard
View generate-client.sh
#!/usr/bin/env bash
if [ -z "$1" ]
then
echo "$0 client-name"
exit 1
fi
@fredrike
fredrike / __note.md
Last active May 23, 2021
hass.io on Synology
View __note.md
View tfiac.py
"""Climate platform that offers a climate device for the TFIAC protocol."""
import logging
import voluptuous as vol
from homeassistant.components.climate import (
PLATFORM_SCHEMA, SUPPORT_FAN_MODE, SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE,
SUPPORT_SWING_MODE, SUPPORT_TARGET_TEMPERATURE, ClimateDevice)
from homeassistant.const import (ATTR_TEMPERATURE, CONF_HOST, STATE_OFF,
STATE_ON, TEMP_FAHRENHEIT)
View df-time.sh
while true; do (df -m /volume2 /volume3; iostat -m -d sdb|sed -ne "4,4p;4q") | tr -d '\n'| awk '{printf " Status %0.2f% %, %0.2fTB (%s) left @ %0.2fMB/s ETA %s \r", $9/$14, ($14-$9)/1024/1024, strftime("%T", ($14-$9)/$20), $20, strftime("%F %T", systime()+($14-$9)/$20)}'|tee ~/hass/www/custom-lovelace/stat.txt; sleep 15; done
View tellduslive.py
"""
Support for Tellstick Net/Telstick Live.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.tellduslive/
"""
import logging
from homeassistant.components import sensor, tellduslive
from homeassistant.components.tellduslive.entry import TelldusLiveEntity