Implement Wallboard Display Toggle with Automations

This commit is contained in:
Florian Brinker 2019-10-22 20:40:01 +02:00
parent 31786e6658
commit 2b83cf6374
7 changed files with 119 additions and 9 deletions

View File

@ -17,6 +17,7 @@
- switch.harmony_playstation
- switch.harmony_denon_power
- switch.desktop_wol
- switch.wallboard_display
# include_domains:
# - switch
# exclude_entities:
@ -62,4 +63,7 @@
switch.desktop_wol:
name: Computer
description: Computer im Büro
switch.wallboard_display:
name: Display
description: Wallboard Display
# ACHTUNG: WHITELIST EBENFALLS ERGÄNZEN!

View File

@ -0,0 +1,25 @@
- alias: Wallboard On
trigger:
- platform: state
entity_id: binary_sensor.anyone_home
to: 'on'
- platform: state
entity_id: sensor.harmony_activity
from: 'Fire TV sehen'
action:
service: switch.turn_on
data:
entity_id: switch.wallboard_display
- alias: Wallboard Off
trigger:
- platform: state
entity_id: binary_sensor.anyone_home
to: 'off'
- platform: state
entity_id: sensor.harmony_activity
to: 'Fire TV sehen'
action:
service: switch.turn_off
data:
entity_id: switch.wallboard_display

View File

@ -204,6 +204,18 @@ binary_sensor:
value_template: "{{ is_state('sensor.camera_mode_office', 'start') or is_state('sensor.camera_mode_office', 'recording') }}"
cctv_motion_detection_active:
value_template: "{{ (is_state('sensor.camera_mode_office', 'start') or is_state('sensor.camera_mode_office', 'recording')) and is_state('sensor.camera_motion_office', 'True') }}"
- platform: command_line
name: Wallboard HDMI Status
command: !secret wallboard_hdmi_status_cmd
payload_on: display_power=1
payload_off: display_power=0
scan_interval: 60
- platform: template
sensors:
anyone_home:
value_template: >-
{{ is_state('person.florian', 'home')
or is_state('person.jenny', 'home') }}
weather:
- platform: openweathermap

View File

@ -26,10 +26,19 @@ cards:
- entity: sensor.device_mobile_fb_battery
name: Handy-Akku
icon: mdi:battery
- type: entities
title: Wake On Lan
show_header_toggle: false
entities:
- entity: switch.desktop_wol
name: Desktop-PC
icon: mdi:desktop-classic
- type: horizontal-stack
cards:
- type: entities
title: Wake On Lan
show_header_toggle: false
entities:
- entity: switch.desktop_wol
name: Desktop-PC
icon: mdi:desktop-classic
- type: entities
title: Wallboard
show_header_toggle: false
entities:
- entity: switch.wallboard_display
name: Display
icon: mdi:tablet

View File

@ -165,4 +165,26 @@ shinobi_notify:
Confidence: {{ confidence }}
Letzte Aufnahmen:
- [{{ video_last }}]({{ video_url }}/{{ video_last }})
- [{{ video_previous }}]({{ video_url }}/{{ video_previous }})
- [{{ video_previous }}]({{ video_url }}/{{ video_previous }})
# Wallboard
wallboard_hdmi_on:
sequence:
- service: shell_command.ssh
data:
sshkey: !secret sshkey_wallboard_hdmi
host: !secret wallboard_ip
user: !secret wallboard_ssh_user
port: !secret wallboard_ssh_port
command_or_param: display_power 1
wallboard_hdmi_off:
sequence:
- service: shell_command.ssh
data:
sshkey: !secret sshkey_wallboard_hdmi
host: !secret wallboard_ip
user: !secret wallboard_ssh_user
port: !secret wallboard_ssh_port
command_or_param: display_power 0

View File

@ -0,0 +1,28 @@
#!/usr/bin/env bash
DIR=$(dirname "$(readlink -f "$0")")
KEYFILE="$DIR/../ssh-key/homeassistant-wallboard-hdmi-sshkey"
TARGET="~/.ssh/authorized_keys"
if [ $# == 0 ] ; then
echo "Usage: install-wallboard-hdmi-sshkey.sh user@wallboard-ip"
exit 1;
fi
if [ ! -f $KEYFILE ]; then
echo "You need to create the SSH-Key-File first: \"$KEYFILE\""
echo "Use: \"ssh-keygen -t ed25519 -C homeassistant-wallboard-hdmi-sshkey -f $KEYFILE\""
exit 1
fi
SSHKEY=$(<"$KEYFILE.pub")
echo "command=\"vcgencmd \$SSH_ORIGINAL_COMMAND\" $SSHKEY" | ssh $1 '\
mkdir -p .ssh && \
chmod 700 .ssh && \
touch .ssh/authorized_keys && \
chmod 600 .ssh/authorized_keys && \
tee -a .ssh/authorized_keys \
' >/dev/null
echo "Installed the ssh key into \"$1:$TARGET\"."

View File

@ -127,4 +127,14 @@
turn_on:
service: script.shinobi_active
turn_off:
service: script.shinobi_idle
service: script.shinobi_idle
### Wallboard
wallboard_display:
friendly_name: Wallboard Display Toggle
value_template: "{{ is_state('binary_sensor.wallboard_hdmi_status', 'on') }}"
turn_on:
service: script.wallboard_hdmi_on
turn_off:
service: script.wallboard_hdmi_off