Skip to content

Instantly share code, notes, and snippets.

@ophilips
ophilips / xiaomi_fan_configuration.yaml
Last active June 1, 2023 21:34
Xiaomi Vacuum as "template fan" for Home Assistant/HomeKit. The fan slider (0-100) in HomeKit will be translated to the the corresponding vacuum presets or speeds (off, Silent, Standard, Medium, Turbo).
# Xiaomi HomeKit
fan:
- platform: template
fans:
xiaomi_fan:
friendly_name: "Xiaomi Vacuum"
value_template: "{%if states('vacuum.xiaomi_vacuum_cleaner') == 'cleaning' %}on{%elif states('vacuum.xiaomi_vacuum_cleaner') == 'paused' %}on{%else %}off{% endif %}"
speed_template: "{{ state_attr('vacuum.xiaomi_vacuum_cleaner', 'fan_speed') }}"
turn_on:
service: vacuum.start
@ophilips
ophilips / asound.conf
Last active January 9, 2019 09:56
Convert Stereo to balanced Mono
pcm.card0 {
type hw
card 0
}
ctl.card0 {
type hw
card 0
}
@ophilips
ophilips / airquality_configuration.yaml
Last active December 18, 2018 08:53
Home Assistant Sensor; Airquality at measuring station "Kendlerstraße" in Vienna. Station can be changed to any that supports PM2.5 measurements.
# Airquality at measuring station "Kendlerstraße" in Vienna
sensor:
- platform: command_line
name: wien pm25
scan_interval: 3600
command: curl https://www.wien.gv.at/ma22-lgb/tb/tb-aktuell.htm | grep -oP "Kendler.+\|.+\|.+\|.+\|.+\|\s+\K\d{0,3}(?=.\|.+\|.+\|)"
value_template: '{{ value | int }}'
unit_of_measurement: 'µg/m³'
@ophilips
ophilips / iiyama_configuration.yaml
Last active April 21, 2019 11:44
Control Iiyama X4071 Brightness with Home Assistant
binary_sensor:
- platform: command_line
name: Monitor Status
command: ( /bin/echo -en "1048_b{{'%03d'%states.input_number.iiyama.state|int}}{{'\r'}}" > /dev/ttyUSB0 & timeout 2 /bin/cat < /dev/ttyUSB0 | /bin/grep -oP "1048_b" ; /bin/echo "off" ) | head -n 1
payload_on: "1048_b"
payload_off: "off"
scan_interval: 10
input_boolean:
iiyama:
@ophilips
ophilips / zigbee2mqtt_configuration.yaml
Last active January 17, 2020 15:46
Simple Zigbee to MQTT configuration for Home Assistant (Updated for 0.104)
# Availability and lock status of Zigbee network
lock:
- platform: mqtt
name: Zigbee Network
state_topic: "zigbee2mqtt/bridge/config"
state_locked: "False"
state_unlocked: "True"
value_template: '{{value_json.permit_join}}'
command_topic: "zigbee2mqtt/bridge/config/permit_join"
payload_lock: "false"