diff --git a/hass/README.md b/hass/README.md new file mode 100644 index 0000000..14aa14a --- /dev/null +++ b/hass/README.md @@ -0,0 +1,4 @@ +# Homeassistant + +## Remote PC Start / Stop +https://www.creatingsmarthome.com/index.php/2022/02/12/guide-start-up-and-shut-down-remote-linux-pc-using-home-assistant/ diff --git a/hass/copy-auth-component.sh b/hass/copy-auth-component.sh new file mode 100755 index 0000000..7452230 --- /dev/null +++ b/hass/copy-auth-component.sh @@ -0,0 +1,2 @@ +docker cp hass-auth-header/custom_components/auth_header/ homeassistant:/config/custom_components + diff --git a/hass/homeassistant/automations.yaml b/hass/homeassistant/automations.yaml new file mode 100644 index 0000000..88555d0 --- /dev/null +++ b/hass/homeassistant/automations.yaml @@ -0,0 +1,480 @@ +- id: '1624196515767' + alias: Tomaten gießen + description: '' + trigger: + - platform: time_pattern + hours: /1 + condition: + - condition: time + after: '8:00' + before: '18:00' + action: + - service: switch.turn_on + target: + entity_id: switch.pumpe + mode: single +- id: '1624634681188' + alias: Gewächshaus will Aufmerksamkeit + description: '' + trigger: + - platform: numeric_state + entity_id: sensor.humidity_3 + below: '30' + - platform: numeric_state + entity_id: sensor.temperature_2 + above: '40' + condition: [] + action: + - device_id: 7c3a631e6abfb88bfaa5ae50919d668a + domain: mobile_app + type: notify + title: Gewächshaus will Aufmerksamkeit + message: Kümmere Dich endlich! + - device_id: b91045df7b5df4f34d179afb4bb87d18 + domain: mobile_app + type: notify + title: Gewächshaus will Aufmerksamkeit + message: Mach mal + mode: single +- id: '1624639556738' + alias: Sensorbatterie + description: '' + trigger: + - platform: numeric_state + entity_id: sensor.battery + below: '3600' + condition: [] + action: + - device_id: b91045df7b5df4f34d179afb4bb87d18 + domain: mobile_app + type: notify + title: Sensorbatterie + message: Sensorbatterie + mode: single +- id: '1625750877117' + alias: Tomaten gießen wenn warm + description: '' + trigger: + - platform: time_pattern + minutes: /50 + condition: + - condition: numeric_state + entity_id: sensor.temperature_2 + above: '30' + - condition: time + after: '10:00' + before: '16:00' + action: + - service: switch.turn_on + target: + entity_id: switch.pumpe + mode: single +- id: '1723274410344' + alias: Fernbedienung + description: '' + trigger: + - platform: device + domain: mqtt + device_id: 7ee7af674fef326af8b7d7f20d1d00d6 + type: action + subtype: 'on' + condition: [] + action: + - action: light.turn_on + target: + entity_id: + - light.bogenlampe + data: {} + - action: light.turn_on + target: + entity_id: light.lichtschlauch_white + data: {} + - action: light.turn_off + metadata: {} + data: + transition: 1 + target: + entity_id: light.lichtschlauch_rgb + mode: single +- id: '1723274776341' + alias: Fernbedienung aus + description: '' + trigger: + - platform: device + domain: mqtt + device_id: 7ee7af674fef326af8b7d7f20d1d00d6 + type: action + subtype: 'off' + condition: [] + action: + - action: light.turn_off + metadata: {} + data: {} + target: + device_id: + - 8a71457ca3d2c1be55ea34f0037e8756 + - 9d7380c58b619962e11dda1d5a060938 + mode: single +- id: '1725182808963' + alias: Flurlampe an + description: '' + triggers: + - event: sunset + offset: '-3600' + trigger: sun + - trigger: time + at: 06:30:00 + conditions: [] + actions: + - action: light.turn_on + metadata: {} + data: + brightness_pct: 90 + target: + device_id: + - da8053e3c99c43fa802f32627d9ec42e + mode: single +- id: '1725182915207' + alias: Flurlampe aus + description: '' + triggers: + - at: 01:00:00 + trigger: time + - trigger: time + at: 09:15:00 + conditions: [] + actions: + - action: light.turn_off + metadata: {} + data: {} + target: + device_id: + - da8053e3c99c43fa802f32627d9ec42e + mode: single +- id: '1732045729333' + alias: Wasser Spüle + description: '' + trigger: + - type: moist + platform: device + device_id: ed19b3502ef3dad70cca3de834a993bc + entity_id: af627c5df02c10ebfdc7e677b2934f12 + domain: binary_sensor + condition: [] + action: + - action: notify.mobile_app_sm_a536b + metadata: {} + data: + message: Wasser unter der Spüle! + - action: notify.mobile_app_sm_s901b + metadata: {} + data: + message: Wasser unter der Spüle! + mode: single +- id: '1732467176209' + alias: Controller - Philips 929002398602 Hue Dimmer switch v2 + description: '' + use_blueprint: + path: EPMatt/philips_929002398602.yaml + input: + integration: Zigbee2MQTT + controller_entity: sensor.fernbedienung_bad_battery + helper_last_controller_event: input_text.last_controller_event2 + action_button_up_double: + - action: light.turn_on + metadata: {} + data: + kelvin: 4222 + target: + device_id: 4a993938cbf7289987eb684f71b00b92 + action_button_down_double: + - action: light.turn_on + metadata: {} + data: + kelvin: 2627 + target: + device_id: 4a993938cbf7289987eb684f71b00b92 +- id: '1732736495026' + alias: Lichter aus bei Sonnenaufgang + description: '' + trigger: + - platform: time + at: 01:00:00 + condition: [] + action: + - action: light.turn_off + metadata: {} + data: {} + target: + device_id: 03477708398bb2e1ceb3f4a776770a29 + mode: single +- id: '1732736623945' + alias: Licht an bei Sonnenuntergang + description: '' + trigger: + - platform: sun + event: sunset + offset: -00:30:00 + condition: [] + action: + - action: light.turn_on + metadata: {} + data: + kelvin: 2490 + brightness_pct: 85 + target: + device_id: 03477708398bb2e1ceb3f4a776770a29 + mode: single +- id: '1733523441756' + alias: Küche Theke Schalter + description: '' + triggers: + - device_id: f9bd33dde8040b0c80b8ef35f0eff174 + domain: shelly + type: single_push + subtype: button1 + trigger: device + conditions: [] + actions: + - type: toggle + device_id: a09f77bde7ba5098df0c3ec599ca7377 + entity_id: 2a315e13dac7a4d0e3a5331216e79a5b + domain: switch + - type: toggle + device_id: aa992894922dfd99d4de351691fddbeb + entity_id: c9e060ed610aaa859483ed162741f6b8 + domain: light + mode: single +- id: '1733523672915' + alias: Nur Küchentisch Doppelklick + description: '' + triggers: + - device_id: f9bd33dde8040b0c80b8ef35f0eff174 + domain: shelly + type: double_push + subtype: button1 + trigger: device + conditions: [] + actions: + - type: toggle + device_id: 0477c12763b17a6f8e00e457e2241c65 + entity_id: 47503c95c474e4f8bfba5f00c725a1d4 + domain: light + mode: single +- id: '1733523711057' + alias: Nur Küche Theke Dreifachklick + description: '' + triggers: + - device_id: f9bd33dde8040b0c80b8ef35f0eff174 + domain: shelly + type: triple_push + subtype: button1 + trigger: device + conditions: [] + actions: + - type: toggle + device_id: a09f77bde7ba5098df0c3ec599ca7377 + entity_id: 2a315e13dac7a4d0e3a5331216e79a5b + domain: switch + mode: single +- id: '1733524257607' + alias: Alles aus Wohnzimmer + description: '' + triggers: + - device_id: f9bd33dde8040b0c80b8ef35f0eff174 + domain: shelly + type: long_push + subtype: button1 + trigger: device + conditions: [] + actions: + - action: light.turn_off + metadata: {} + data: {} + target: + area_id: wohnzimmer + - type: turn_off + device_id: a09f77bde7ba5098df0c3ec599ca7377 + entity_id: 2a315e13dac7a4d0e3a5331216e79a5b + domain: switch + - action: light.turn_off + metadata: {} + data: {} + target: + device_id: aa992894922dfd99d4de351691fddbeb + mode: single +- id: '1733558486213' + alias: Küche Theke und Tisch aus + description: '' + triggers: + - device_id: f9bd33dde8040b0c80b8ef35f0eff174 + domain: shelly + type: single_push + subtype: button1 + trigger: device + conditions: + - condition: device + type: is_on + device_id: a09f77bde7ba5098df0c3ec599ca7377 + entity_id: 2a315e13dac7a4d0e3a5331216e79a5b + domain: switch + actions: + - action: light.turn_off + metadata: {} + data: {} + target: + device_id: + - 0477c12763b17a6f8e00e457e2241c65 + - type: turn_off + device_id: a09f77bde7ba5098df0c3ec599ca7377 + entity_id: 2a315e13dac7a4d0e3a5331216e79a5b + domain: switch + mode: single +- id: '1733558619917' + alias: Küche Theke und Tisch an + description: '' + triggers: + - device_id: f9bd33dde8040b0c80b8ef35f0eff174 + domain: shelly + type: single_push + subtype: button1 + trigger: device + conditions: + - condition: device + type: is_off + device_id: a09f77bde7ba5098df0c3ec599ca7377 + entity_id: 2a315e13dac7a4d0e3a5331216e79a5b + domain: switch + actions: + - action: light.turn_on + metadata: {} + data: {} + target: + device_id: 0477c12763b17a6f8e00e457e2241c65 + - type: turn_on + device_id: a09f77bde7ba5098df0c3ec599ca7377 + entity_id: 2a315e13dac7a4d0e3a5331216e79a5b + domain: switch + mode: single +- id: '1733861633781' + alias: Fernbedienung wieder hell + description: '' + triggers: + - domain: mqtt + device_id: 7ee7af674fef326af8b7d7f20d1d00d6 + type: action + subtype: color_temperature_move + trigger: device + conditions: + - condition: state + entity_id: light.kuchentisch + state: 'off' + actions: + - action: scene.turn_on + metadata: {} + data: {} + target: + entity_id: + - scene.maximales_licht + mode: single +- id: '1733861763897' + alias: Fernbedienung abdunkeln + description: '' + triggers: + - domain: mqtt + device_id: 7ee7af674fef326af8b7d7f20d1d00d6 + type: action + subtype: color_temperature_move + trigger: device + conditions: + - condition: device + type: is_on + device_id: 0477c12763b17a6f8e00e457e2241c65 + entity_id: 47503c95c474e4f8bfba5f00c725a1d4 + domain: light + actions: + - action: scene.turn_on + metadata: {} + data: {} + target: + entity_id: scene.hanna_schlafmodus + mode: single +- id: '1733862634974' + alias: Küche Wohnzimmer an + description: '' + triggers: + - domain: mqtt + device_id: ece48086d0eb3844ccba5f333ee59ceb + type: action + subtype: 'on' + trigger: device + conditions: [] + actions: + - action: light.turn_on + metadata: {} + data: {} + target: + area_id: + - wohnzimmer + - kuche + - type: turn_on + device_id: a09f77bde7ba5098df0c3ec599ca7377 + entity_id: 2a315e13dac7a4d0e3a5331216e79a5b + domain: switch + - type: turn_on + device_id: 1c7100c71320f1603884443c7fd2092d + entity_id: 276285d3b1143417515620cef9615128 + domain: switch + mode: single +- id: '1733862691860' + alias: Küche Wohnzimmer aus + description: '' + triggers: + - domain: mqtt + device_id: ece48086d0eb3844ccba5f333ee59ceb + type: action + subtype: 'off' + trigger: device + conditions: [] + actions: + - action: light.turn_off + metadata: {} + data: {} + target: + area_id: + - kuche + - wohnzimmer + - type: turn_off + device_id: a09f77bde7ba5098df0c3ec599ca7377 + entity_id: 2a315e13dac7a4d0e3a5331216e79a5b + domain: switch + - type: turn_off + device_id: 1c7100c71320f1603884443c7fd2092d + entity_id: 276285d3b1143417515620cef9615128 + domain: switch + mode: single +- id: '1735746687673' + alias: Lüftung Bad automatisch aus + description: '' + triggers: + - type: turned_on + device_id: ef6d5a43ae7c971e4b7b740dbc0f378e + entity_id: d212bffda3c532f2e43ea9d08b1fd008 + domain: switch + trigger: device + for: + hours: 0 + minutes: 30 + seconds: 0 + conditions: + - condition: device + type: is_on + device_id: ef6d5a43ae7c971e4b7b740dbc0f378e + entity_id: d212bffda3c532f2e43ea9d08b1fd008 + domain: switch + actions: + - type: turn_off + device_id: ef6d5a43ae7c971e4b7b740dbc0f378e + entity_id: d212bffda3c532f2e43ea9d08b1fd008 + domain: switch + mode: single diff --git a/hass/homeassistant/configuration.yaml b/hass/homeassistant/configuration.yaml new file mode 100644 index 0000000..8834a8f --- /dev/null +++ b/hass/homeassistant/configuration.yaml @@ -0,0 +1,111 @@ +# Configure a default setup of Home Assistant (frontend, api, etc) +default_config: + +# Text to speech +tts: + - platform: google_translate + +group: !include groups.yaml +automation: !include automations.yaml +script: !include scripts.yaml +scene: !include scenes.yaml +shell_command: !include shell_commands.yaml + +switch: + - platform: wake_on_lan + name: "mini PC" + host: "192.168.178.87" + mac: "58:47:CA:78:4E:59" + turn_off: + service: shell_command.turn_off_remote_pc + + +#MQTT Broker for milight hub: +mqtt: + sensor: + - name: 'Temperature' + state_topic: 'living/sensor1' + unit_of_measurement: '°C' + value_template: '{{ value_json.temperature }}' + + - name: 'Humidity' + state_topic: 'living/sensor1' + unit_of_measurement: '%' + value_template: '{{ value_json.humidity }}' + + - name: 'Temperature 2' + state_topic: 'living/sensor2' + unit_of_measurement: '°C' + value_template: '{{ value_json.temperature }}' + + + - name: 'Humidity 2' + state_topic: 'living/sensor2' + unit_of_measurement: '%' + value_template: '{{ value_json.humidity }}' + + - name: 'Humidity 3' + state_topic: 'living/sensor2' + unit_of_measurement: '%' + value_template: '{{ value_json.soilhumidity }}' + + - name: 'Battery' + state_topic: 'living/sensor2' + unit_of_measurement: 'mV' + value_template: '{{ value_json.battery }}' + + switch: + - name: "Schalter 1 Schreibtisch" + command_topic: living/plug + payload_on: "83029" + payload_off: "83028" + + - name: "Schalter 2 HerrBert" + command_topic: living/plug + payload_on: "86101" + payload_off: "86100" + + - name: "Schalter 3 Schlafzimmer TV" + command_topic: living/plug + payload_on: "70741" + payload_off: "70740" + + - name: "Steckdose 4" + command_topic: living/plug + payload_on: "21589" + payload_off: "21588" + + - name: "Pumpe" + command_topic: greenhousino/pump + state_topic: greenhousino/pumpstate + payload_on: "90000" + payload_off: "off" + + +# enable the recorder integration (optional) +recorder: + + +http: + # For extra security set this to only accept connections on localhost if NGINX is on the same machine + # Uncommenting this will mean that you can only reach Home Assistant using the proxy, not directly via IP from other client + ip_ban_enabled: true + login_attempts_threshold: 10 + use_x_forwarded_for: true + # You must set the trusted proxy IP address so that Home Assistant will properly accept connections + # Set this to your NGINX machine IP, or localhost if hosted on the same machine. + trusted_proxies: 192.168.178.0/24 + +auth_header: + username_header: X-authentik-username + # Optionally set this if you're not using authentik proxy or oauth2_proxy + # username_header: X-Forwarded-Preferred-Username + # Optionally set this if you don't want to bypass the login prompt + # allow_bypass_login: false + # Optionally enable debug mode to see the headers Home-Assistant gets + debug: true +# Optionally, if something is not working right, add this block below to get more information +logger: + default: info + logs: + custom_components.auth_header: debug diff --git a/hass/restart-ha.sh b/hass/restart-ha.sh new file mode 100755 index 0000000..63e309e --- /dev/null +++ b/hass/restart-ha.sh @@ -0,0 +1 @@ +docker-compose stop homeassistant && docker-compose up -d diff --git a/hass/zb2mqttdata/configuration.yaml b/hass/zb2mqttdata/configuration.yaml new file mode 100644 index 0000000..84ae153 --- /dev/null +++ b/hass/zb2mqttdata/configuration.yaml @@ -0,0 +1,55 @@ +mqtt: + server: mqtt://mqtt:1883 + serial: + port: /dev/ttyACM0 +frontend: + enabled: true +advanced: + log_level: debug +device_options: {} +devices: + '0xf0d1b800001ffcf2': + friendly_name: Bogenlampe + '0xa4c138570b1956d9': + friendly_name: '0xa4c138570b1956d9' + '0xa4c1383ec7aa7d95': + friendly_name: '0xa4c1383ec7aa7d95' + '0xa4c1383db5531833': + friendly_name: '0xa4c1383db5531833' + '0x000d6f00109eb214': + friendly_name: Fernbedienung + '0x00212effff0cb8b6': + friendly_name: Lichtschlauch + '0x0ceff6fffebf4739': + friendly_name: '0x0ceff6fffebf4739' + '0xa4c138541ec8ddd2': + friendly_name: Flur + '0xa4c1384187f0960d': + friendly_name: Wasser Sensor Spüle + '0x001788010d1c884e': + friendly_name: Badlampe + '0x001788010e8a8be7': + friendly_name: Fernbedienung Bad + '0xa4c13864e6c8c400': + friendly_name: Bewegungsmelder 1 + '0xa4c138ef60e2fdbe': + friendly_name: Sensor Terassentür + '0x00158d00053a1aab': + friendly_name: '0x00158d00053a1aab' + '0x00158d00053c6311': + friendly_name: '0x00158d00053c6311' + '0xf0d1b800001388f0': + friendly_name: Flurlicht + '0x7cb03eaa0a0176bd': + friendly_name: Küchentisch + '0x000d6f001417c142': + friendly_name: Fernbedienung 2 + '0xa4c138e68023f4c6': + friendly_name: Wassersensor Keller + '0xa4c1389d42e94844': + friendly_name: Temperatur Keller + '0xa4c13838ba59a1b2': + friendly_name: Medienschrank Wohnzimmer +homeassistant: + enabled: true +version: 4