Skip to content

Instantly share code, notes, and snippets.

View xbmcnut's full-sized avatar

xbmcnut

View GitHub Profile
@xbmcnut
xbmcnut / shelly.yaml
Created October 9, 2018 01:19
Package to add two Shelly2's to Home Assistant
###################################
## Customize
###################################
homeassistant:
customize:
switch.family_room_fan:
hidden: False
icon: mdi:fan
light:
@xbmcnut
xbmcnut / harmony_remote.yaml
Last active March 23, 2019 22:31
Package to control my Harmony Hub system. Switches are added to Cloud config for Google and Alexa control
###################################
## Customize
###################################
homeassistant:
customize:
switch.kodi:
hidden: false
icon: mdi:movie-roll
switch.magic_tv:
hidden: false
@xbmcnut
xbmcnut / ask_google.yaml
Created February 5, 2019 00:40
Package to allow Google TTS to advise of HA states for key devices. Scripts added directly to Cloud config.
script:
speak_garage_status:
alias: 'Ask Google for Garage Status'
sequence:
- delay:
seconds: 2
- service: tts.google_say
entity_id:
- media_player.kitchen_home
- media_player.insignia_speaker
@xbmcnut
xbmcnut / power_monitoring.yaml
Created March 23, 2019 02:08
Power monitoring and costing package using mostly Xiaomi smart Xigbee sockets
sensor:
- platform: template
sensors:
total_power_usage:
value_template: '{{ ((states.sensor.xiaomi_tv_power.state | float) +
(states.sensor.xiaomi_office_power.state | float) +
(states.sensor.xiaomi_server_power.state | float) +
(states.sensor.pool_pump_power.state | float) +
(states.sensor.cupboard_light_power.state | float) +
(states.sensor.stairs_shelly_power.state | float) +
@xbmcnut
xbmcnut / shelly_pir.yaml
Last active May 20, 2024 01:01
Making an outdoor motion sensor smart using a Shelly 1
/**
* I figured out you can fit a Shelly 1 inside the case of many outdoor motion sensors.
* Coupled with that fact that recently, Shelly added a feature to de-couple the switch from the relay
* so they act independently, makes this a great combo! Simply wire the output of the PIR motion sensor
* (the wire that normally goes to your outdoor light) to the switch input of the Shelly and wire
* the lightbulb to the L output of the Shelly. Then, in the Shelly app or directly via the devices webpage,
* select the button type as 'Detached Switch' and use the code below to make it work normally.
* Don't forget to adjust the daylight sensitivity to full daylight if you want the motion detection to work 24/7.
*/
@xbmcnut
xbmcnut / shellypm1_fan.yaml
Last active March 12, 2021 08:19
How to make a dumb device smart using a Shelly PM1 | Fan Template example in Home Assistant
fan:
- platform: template
fans:
template_bedroom_fan:
friendly_name: "Master Bedroom Fan"
# Measures the power use from a Shelly1 PM and if over 3W, marks the fan as on
value_template: "{% if states('sensor.bedroom_fan_shelly_power') | float > 3 %}on{% else %}off{% endif %}"
# Uses the Shelly1 PM sensor value to determine what speed the fan is going at. Only set to measure 1, 2 & 3
speed_template: "{{ states('sensor.template_fan_speed_master') }}"
# Uses a fake switch from an input_boolean as the fan has no way of reporting direction back to HA
@xbmcnut
xbmcnut / arilux.yaml
Last active August 31, 2020 05:21
Arilux RGB Smart Bulb with Tasmota
Light is now picked up using setoption 19 1 (discovery)
@xbmcnut
xbmcnut / tablets.yaml
Created April 25, 2020 09:52
GUI File for my Samsung Tablet interface used as the main screen for my house.
##
@xbmcnut
xbmcnut / solar.yaml
Created May 3, 2020 02:39
Solar panel pump with differential in/out temperature sensing for pump control
input_number:
### Solar Pump Hysteresis Offsets ##
pump_off_offset:
name: Pump OFF offset
initial: 0.1
min: 0
max: 2
step: 0.1
pump_on_offset:
@xbmcnut
xbmcnut / ghm_tts.yaml
Created June 22, 2020 10:58
How to get TTS announcements without interrupting Google speakers that are already being used.
# ghm_tts:
alias: 'Google Home Notifier'
sequence:
- service: media_player.volume_set
data_template:
entity_id: >-
{%- set players = ['media_player.kitchen_home', 'media_player.lounge_home', 'media_player.bathroom_speaker', 'media_player.ensuite_speaker'] %}
{{ states.media_player | selectattr('state','!=','playing') | selectattr('entity_id', 'in', players) | map(attribute='entity_id') | join(', ') }}
volume_level: '{{volume}}'
- service: tts.google_say