Skip to content

Instantly share code, notes, and snippets.

@MoritzBuetzer
MoritzBuetzer / configuration.yaml
Created April 27, 2023 08:24
Home Assistant sensor to get co2value from CONNY - https://co2ampel.online/
sensor:
- platform: tcp
host: <CONNY_IP>
port: 4000
payload: "{'cmd':'GET_VALUE'}"
name: "CO2 Ampel"
- platform: template
sensors:
co2_value:
friendly_name: "CO2 Wert"
@MoritzBuetzer
MoritzBuetzer / vzug.yaml
Created December 21, 2020 08:17
REST Integration for V-Zug Home Appliances in Home Assistant
- platform: rest
resource: http://[DEVICE_IP]/ai?command=getDeviceStatus
name: 'V-Zug CookTopInduktion V6000'
authentication: digest
username: !secret vzug.username
password: !secret vzug.password
json_attributes:
- DeviceName
- Serial
- Inactive
@MoritzBuetzer
MoritzBuetzer / hue_automation.yaml
Last active November 26, 2020 16:20
Automation for Home Assistant. Hue Light with random color, every evening 15 Minutes before sunset until 23:45. Source: https://community.home-assistant.io/t/set-a-random-color-on-a-light/73145 and https://community.home-assistant.io/t/automation-to-set-same-random-colour-on-two-hue-lights/151343
- alias: "Turn on light with random color"
id: babc0ffa-622e-450a-a8c4-8dcddbb7e1f3
initial_state: True
trigger:
platform: sun
event: sunset
offset: "-00:15:00"
action:
service: light.turn_on
entity_id: light.hue_color_table_1
@MoritzBuetzer
MoritzBuetzer / days.yaml
Created November 13, 2020 13:17
Get current Weekday in German – Home Assistant Template
{% set tage = ["Sonntag", "Montag", "Dìenstag", "Mìttwoch", "Donnerstag", "Freitag", "Samstag"] %}
{% set dayIndex = as_timestamp(state_attr('weather.basel','forecast').0.datetime) | timestamp_custom("%w") | int %}
{% set wochentag = tage[dayIndex] %}
@MoritzBuetzer
MoritzBuetzer / dingz.yaml
Last active November 24, 2020 13:43
Simple way to control the dingz LED from Home Assistant – https://www.dingz.ch/
# in configuration.yaml
rest_command:
dingz_led:
url: http://DINGZ_IP/api/v1/led/set
method: POST
payload: 'action={{ action }}&color={{ color }}&mode=rgb'
content_type: 'application/x-www-form-urlencoded; charset=utf-8'
# use it as service
- service: rest_command.dingz_led
@MoritzBuetzer
MoritzBuetzer / rc.local
Last active May 7, 2020 05:34
RaspberryPi Shutdown Script
# Add following line to /etc/rc.local
python /home/pi/scripts/shutdown.py &
@MoritzBuetzer
MoritzBuetzer / letsencrypt.yaml
Created April 15, 2020 20:52
Home Assistant Automation to renew Let's Encrypt Certificate
- alias: "Let's Encrypt Renewal"
trigger:
platform: time
at: '02:30:00'
action:
- service: hassio.addon_restart
data:
addon: core_letsencrypt
@MoritzBuetzer
MoritzBuetzer / salt_level_sensor.yaml
Created October 17, 2019 09:38
Ultrasonic Saltlevel sensor
# Ultrasonic Saltlevel sensor
# Source: https://adonno.com/salt-level-sensor/
esphome:
name: salt_level_sensor
platform: ESP8266
board: d1_mini
# WiFi connection, replace these with values for your WiFi.
wifi:
@MoritzBuetzer
MoritzBuetzer / date.js
Created September 5, 2019 13:40
Month and Date of JavaScript in 2 digit format
// day
("0" + dateObj.getDate()).slice(-2)
// month
("0" + (dateObj.getMonth() + 1)).slice(-2)
@MoritzBuetzer
MoritzBuetzer / int_casting.vm
Created February 19, 2019 06:38
velocity integer casting
#set( $integer = 0 )
#set( $castedInt = $integer.parseInt($string) )