Add shinobi, wakeonlan workaround, optimized harmony switch code
This commit is contained in:
parent
2e501bc322
commit
fe5f9caca4
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,10 +11,12 @@
|
|||||||
!/lovelace-views/
|
!/lovelace-views/
|
||||||
!/sensors/
|
!/sensors/
|
||||||
!/www/
|
!/www/
|
||||||
|
!/scripts/
|
||||||
|
|
||||||
# "Force" Disallow
|
# "Force" Disallow
|
||||||
.storage/
|
.storage/
|
||||||
android/
|
android/
|
||||||
|
ssh-key/
|
||||||
|
|
||||||
ip_bans.yaml
|
ip_bans.yaml
|
||||||
secrets.yaml
|
secrets.yaml
|
||||||
|
@ -182,11 +182,11 @@ binary_sensor:
|
|||||||
name: Morning
|
name: Morning
|
||||||
after: '05:00'
|
after: '05:00'
|
||||||
before: '11:00'
|
before: '11:00'
|
||||||
- platform: ffmpeg_motion
|
- platform: ping
|
||||||
input: '-rtsp_transport udp -i rtsp://192.168.2.31/ch0_0.h264'
|
name: desktop_ping
|
||||||
name: camera_home1_motion
|
host: !secret desktop_ip
|
||||||
changes: 50
|
count: 2
|
||||||
reset: 20
|
scan_interval: 15
|
||||||
|
|
||||||
weather:
|
weather:
|
||||||
- platform: openweathermap
|
- platform: openweathermap
|
||||||
@ -205,8 +205,8 @@ stream:
|
|||||||
|
|
||||||
camera:
|
camera:
|
||||||
- platform: ffmpeg
|
- platform: ffmpeg
|
||||||
name: home1
|
name: office
|
||||||
input: '-rtsp_transport tcp -i rtsp://192.168.2.31/ch0_0.h264'
|
input: !secret office_stream_url
|
||||||
|
|
||||||
input_datetime:
|
input_datetime:
|
||||||
bedroom_alarm_clock_time:
|
bedroom_alarm_clock_time:
|
||||||
@ -214,7 +214,18 @@ input_datetime:
|
|||||||
has_date: false
|
has_date: false
|
||||||
has_time: true
|
has_time: true
|
||||||
|
|
||||||
|
shell_command:
|
||||||
|
ssh: 'ssh -o "StrictHostKeyChecking=no" -i {{ sshkey }} {{ host }} -l {{ user }} -p {{ port }} {{ command_or_param }}'
|
||||||
|
|
||||||
|
rest_command:
|
||||||
|
shinobi_monitorstates:
|
||||||
|
url: "https://{{ host }}/{{ apikey }}/monitorStates/{{ group }}/{{ preset_name }}"
|
||||||
|
|
||||||
panel_iframe:
|
panel_iframe:
|
||||||
|
cctv:
|
||||||
|
title: 'CCTV'
|
||||||
|
url: !secret url_cctv
|
||||||
|
icon: mdi:cctv
|
||||||
chronograf:
|
chronograf:
|
||||||
title: 'Chronograf'
|
title: 'Chronograf'
|
||||||
url: !secret url_chronograf
|
url: !secret url_chronograf
|
||||||
@ -228,7 +239,7 @@ panel_iframe:
|
|||||||
url: !secret url_esphome
|
url: !secret url_esphome
|
||||||
icon: mdi:chip
|
icon: mdi:chip
|
||||||
|
|
||||||
alert: !include_dir_merge_list alerts/
|
#alert: !include_dir_merge_list alerts/
|
||||||
alexa: !include alexa.yaml
|
alexa: !include alexa.yaml
|
||||||
automation: !include_dir_merge_list automations/
|
automation: !include_dir_merge_list automations/
|
||||||
#scene: !include scenes.yaml
|
#scene: !include scenes.yaml
|
||||||
|
@ -1,6 +1,21 @@
|
|||||||
icon: mdi:cctv
|
icon: mdi:cctv
|
||||||
path: cctv
|
path: cctv
|
||||||
cards:
|
cards:
|
||||||
- type: picture-entity
|
- type: entities
|
||||||
name: Büro
|
show_header_toggle: false
|
||||||
entity: camera.home1
|
entities:
|
||||||
|
- entity: switch.cctv_active
|
||||||
|
name: Kameras aktiviert
|
||||||
|
icon: mdi:power
|
||||||
|
- entity: switch.cctv_motion_detection
|
||||||
|
name: Aufnahmen bei Bewegung
|
||||||
|
icon: mdi:motion-sensor
|
||||||
|
- type: picture-glance
|
||||||
|
title: Büro
|
||||||
|
camera_image: camera.office
|
||||||
|
camera_view: live
|
||||||
|
entities:
|
||||||
|
- entity: switch.cctv_motion_detection
|
||||||
|
icon: mdi:motion-sensor
|
||||||
|
- entity: switch.cctv_active
|
||||||
|
icon: mdi:power
|
||||||
|
@ -26,3 +26,10 @@ cards:
|
|||||||
- entity: sensor.device_mobile_fb_battery
|
- entity: sensor.device_mobile_fb_battery
|
||||||
name: Handy-Akku
|
name: Handy-Akku
|
||||||
icon: mdi:battery
|
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
|
||||||
|
78
scripts.yaml
78
scripts.yaml
@ -1,3 +1,6 @@
|
|||||||
|
dummy:
|
||||||
|
sequence:
|
||||||
|
|
||||||
ambilight_off:
|
ambilight_off:
|
||||||
alias: Ambilight schwarz schalten
|
alias: Ambilight schwarz schalten
|
||||||
sequence:
|
sequence:
|
||||||
@ -76,4 +79,77 @@ livingroom_netflix_on:
|
|||||||
command:
|
command:
|
||||||
- Ok
|
- Ok
|
||||||
device: 42849848 #FireTv
|
device: 42849848 #FireTv
|
||||||
delay_secs: 0.6
|
delay_secs: 0.6
|
||||||
|
|
||||||
|
### Harmony Helper-Scripts
|
||||||
|
|
||||||
|
harmony_denon_power:
|
||||||
|
alias: Denon Power
|
||||||
|
sequence:
|
||||||
|
- service: remote.send_command
|
||||||
|
data:
|
||||||
|
entity_id: remote.livingroom_harmony
|
||||||
|
command:
|
||||||
|
- PowerToggle
|
||||||
|
device: 42849850 #Denon
|
||||||
|
|
||||||
|
harmony_denon_mute:
|
||||||
|
alias: Denon Stumm
|
||||||
|
sequence:
|
||||||
|
- service: remote.send_command
|
||||||
|
data:
|
||||||
|
entity_id: remote.livingroom_harmony
|
||||||
|
command:
|
||||||
|
- Mute
|
||||||
|
device: 42849850 #Denon
|
||||||
|
|
||||||
|
harmony_volume_up:
|
||||||
|
alias: Denon Lauter
|
||||||
|
sequence:
|
||||||
|
- service: remote.send_command
|
||||||
|
data:
|
||||||
|
entity_id: remote.livingroom_harmony
|
||||||
|
command:
|
||||||
|
- VolumeUp
|
||||||
|
device: 42849850 #Denon
|
||||||
|
num_repeats: 5
|
||||||
|
|
||||||
|
harmony_volume_down:
|
||||||
|
alias: Denon Leiser
|
||||||
|
sequence:
|
||||||
|
- service: remote.send_command
|
||||||
|
data:
|
||||||
|
entity_id: remote.livingroom_harmony
|
||||||
|
command:
|
||||||
|
- VolumeDown
|
||||||
|
device: 42849850 #Denon
|
||||||
|
num_repeats: 5
|
||||||
|
|
||||||
|
# CCTV
|
||||||
|
|
||||||
|
shinobi_idle:
|
||||||
|
sequence:
|
||||||
|
- service: rest_command.shinobi_monitorstates
|
||||||
|
data:
|
||||||
|
host: !secret shinobi_host
|
||||||
|
apikey: !secret shinobi_api_key
|
||||||
|
group: !secret shinobi_group
|
||||||
|
preset_name: Inactive (Idle)
|
||||||
|
|
||||||
|
shinobi_active:
|
||||||
|
sequence:
|
||||||
|
- service: rest_command.shinobi_monitorstates
|
||||||
|
data:
|
||||||
|
host: !secret shinobi_host
|
||||||
|
apikey: !secret shinobi_api_key
|
||||||
|
group: !secret shinobi_group
|
||||||
|
preset_name: Active + Motion Detection OFF
|
||||||
|
|
||||||
|
shinobi_active_with_motion:
|
||||||
|
sequence:
|
||||||
|
- service: rest_command.shinobi_monitorstates
|
||||||
|
data:
|
||||||
|
host: !secret shinobi_host
|
||||||
|
apikey: !secret shinobi_api_key
|
||||||
|
group: !secret shinobi_group
|
||||||
|
preset_name: Active + Motion Detection ON
|
22
scripts/install-wakeonlan-sshkey.sh
Executable file
22
scripts/install-wakeonlan-sshkey.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
|
||||||
|
KEYFILE="$DIR/../ssh-key/homeassistant-wakeonlan-sshkey"
|
||||||
|
TARGET="$HOME/.ssh/authorized_keys"
|
||||||
|
|
||||||
|
if [ ! -f $KEYFILE ]; then
|
||||||
|
echo "You need to create the SSH-Key-File first: \"$KEYFILE\""
|
||||||
|
echo "Use: \"ssh-keygen -t ed25519 -C homeassistant-wakeonlan-sshkey -f $KEYFILE\""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! which wakeonlan > /dev/null; then
|
||||||
|
echo "You need to install \"wakeonlan\" first. Otherwise the ssh-key will be useless."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SSHKEY=$(<"$KEYFILE.pub")
|
||||||
|
echo "command=\"wakeonlan \$SSH_ORIGINAL_COMMAND\" $SSHKEY" >> $TARGET
|
||||||
|
|
||||||
|
echo "Installed the ssh key into \"$TARGET\"."
|
8
sensors/cctv.yaml
Normal file
8
sensors/cctv.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
- platform: rest
|
||||||
|
resource: !secret office_details_url
|
||||||
|
name: Camera Mode Office
|
||||||
|
value_template: '{{ value_json.mode }}'
|
||||||
|
- platform: rest
|
||||||
|
resource: !secret office_details_url
|
||||||
|
name: Camera Motion Office
|
||||||
|
value_template: '{{ value_json.details|string|regex_search("\"detector\":\"1\"", ignorecase=FALSE) }}'
|
0
ssh-key/.gitkeep
Normal file
0
ssh-key/.gitkeep
Normal file
111
switches.yaml
111
switches.yaml
@ -1,10 +1,18 @@
|
|||||||
- platform: wake_on_lan
|
|
||||||
name: Computer
|
|
||||||
mac_address: "50-E5-49-C4-DF-B4"
|
|
||||||
host: "192.168.2.168"
|
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
switches:
|
switches:
|
||||||
|
desktop_wol:
|
||||||
|
value_template: "{{ is_state('binary_sensor.desktop_ping', 'on') }}"
|
||||||
|
turn_on:
|
||||||
|
service: shell_command.ssh
|
||||||
|
data:
|
||||||
|
sshkey: !secret sshkey_wakeonlan
|
||||||
|
host: !secret nas_ip
|
||||||
|
user: !secret nas_ssh_user
|
||||||
|
port: !secret nas_ssh_port
|
||||||
|
command_or_param: !secret desktop_mac
|
||||||
|
turn_off:
|
||||||
|
service: script.dummy
|
||||||
|
|
||||||
harmony_music_bt:
|
harmony_music_bt:
|
||||||
value_template: "{{ is_state_attr('remote.livingroom_harmony', 'current_activity', 'Musik Bluetooth') }}"
|
value_template: "{{ is_state_attr('remote.livingroom_harmony', 'current_activity', 'Musik Bluetooth') }}"
|
||||||
turn_on:
|
turn_on:
|
||||||
@ -57,81 +65,34 @@
|
|||||||
entity_id: remote.livingroom_harmony
|
entity_id: remote.livingroom_harmony
|
||||||
activity: 'PowerOff'
|
activity: 'PowerOff'
|
||||||
|
|
||||||
harmony_denon_mute:
|
|
||||||
friendly_name: Denon Stumm
|
|
||||||
value_template: "{{ state_attr('remote.livingroom_harmony', 'current_activity') != 'PowerOff' }}"
|
|
||||||
turn_on:
|
|
||||||
service: remote.send_command
|
|
||||||
data:
|
|
||||||
entity_id: remote.livingroom_harmony
|
|
||||||
command:
|
|
||||||
- Mute
|
|
||||||
device: 42849850 #Denon
|
|
||||||
turn_off:
|
|
||||||
service: remote.send_command
|
|
||||||
data:
|
|
||||||
entity_id: remote.livingroom_harmony
|
|
||||||
command:
|
|
||||||
- Mute
|
|
||||||
device: 42849850 #Denon
|
|
||||||
|
|
||||||
harmony_denon_power:
|
harmony_denon_power:
|
||||||
friendly_name: Denon Power
|
friendly_name: Denon Power
|
||||||
value_template: "{{ state_attr('remote.livingroom_harmony', 'current_activity') != 'PowerOff' }}"
|
value_template: "{{ state_attr('remote.livingroom_harmony', 'current_activity') != 'PowerOff' }}"
|
||||||
turn_on:
|
turn_on:
|
||||||
service: remote.send_command
|
service: script.harmony_denon_power
|
||||||
data:
|
|
||||||
entity_id: remote.livingroom_harmony
|
|
||||||
command:
|
|
||||||
- PowerToggle
|
|
||||||
device: 42849850 #Denon
|
|
||||||
turn_off:
|
turn_off:
|
||||||
service: remote.send_command
|
service: script.harmony_denon_power
|
||||||
data:
|
|
||||||
entity_id: remote.livingroom_harmony
|
|
||||||
command:
|
|
||||||
- PowerToggle
|
|
||||||
device: 42849850 #Denon
|
|
||||||
|
|
||||||
harmony_volume_down:
|
harmony_denon_mute:
|
||||||
friendly_name: Denon Leiser
|
friendly_name: Denon Stumm
|
||||||
value_template: "{{ state_attr('remote.livingroom_harmony', 'current_activity') != 'PowerOff' }}"
|
value_template: "{{ state_attr('remote.livingroom_harmony', 'current_activity') != 'PowerOff' }}"
|
||||||
turn_on:
|
turn_on:
|
||||||
service: remote.send_command
|
|
||||||
data:
|
|
||||||
entity_id: remote.livingroom_harmony
|
|
||||||
command:
|
|
||||||
- VolumeDown
|
|
||||||
device: 42849850 #Denon
|
|
||||||
num_repeats: 5
|
|
||||||
turn_off:
|
turn_off:
|
||||||
service: remote.send_command
|
service: script.harmony_denon_mute
|
||||||
data:
|
|
||||||
entity_id: remote.livingroom_harmony
|
|
||||||
command:
|
|
||||||
- VolumeDown
|
|
||||||
device: 42849850 #Denon
|
|
||||||
num_repeats: 5
|
|
||||||
|
|
||||||
harmony_volume_up:
|
harmony_volume_up:
|
||||||
friendly_name: Denon Lauter
|
friendly_name: Denon Lauter
|
||||||
value_template: "{{ state_attr('remote.livingroom_harmony', 'current_activity') != 'PowerOff' }}"
|
value_template: "{{ state_attr('remote.livingroom_harmony', 'current_activity') != 'PowerOff' }}"
|
||||||
turn_on:
|
turn_on:
|
||||||
service: remote.send_command
|
|
||||||
data:
|
|
||||||
entity_id: remote.livingroom_harmony
|
|
||||||
command:
|
|
||||||
- VolumeUp
|
|
||||||
device: 42849850 #Denon
|
|
||||||
num_repeats: 5
|
|
||||||
turn_off:
|
turn_off:
|
||||||
service: remote.send_command
|
service: script.harmony_volume_up
|
||||||
data:
|
|
||||||
entity_id: remote.livingroom_harmony
|
harmony_volume_down:
|
||||||
command:
|
friendly_name: Denon Leiser
|
||||||
- VolumeUp
|
value_template: "{{ state_attr('remote.livingroom_harmony', 'current_activity') != 'PowerOff' }}"
|
||||||
device: 42849850 #Denon
|
turn_on:
|
||||||
num_repeats: 5
|
turn_off:
|
||||||
|
service: script.harmony_volume_down
|
||||||
|
|
||||||
livingroom_music:
|
livingroom_music:
|
||||||
value_template: "{{ is_state_attr('remote.livingroom_harmony', 'current_activity', 'Musik Bluetooth') }}"
|
value_template: "{{ is_state_attr('remote.livingroom_harmony', 'current_activity', 'Musik Bluetooth') }}"
|
||||||
@ -148,4 +109,22 @@
|
|||||||
service: remote.turn_on
|
service: remote.turn_on
|
||||||
data:
|
data:
|
||||||
entity_id: remote.livingroom_harmony
|
entity_id: remote.livingroom_harmony
|
||||||
activity: 'PowerOff'
|
activity: 'PowerOff'
|
||||||
|
|
||||||
|
### CCTV
|
||||||
|
|
||||||
|
cctv_motion_detection:
|
||||||
|
friendly_name: CCTV Motion Detection
|
||||||
|
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') }}"
|
||||||
|
turn_on:
|
||||||
|
service: script.shinobi_active_with_motion
|
||||||
|
turn_off:
|
||||||
|
service: script.shinobi_active
|
||||||
|
|
||||||
|
cctv_active:
|
||||||
|
friendly_name: CCTV Active
|
||||||
|
value_template: "{{ is_state('sensor.camera_mode_office', 'start') or is_state('sensor.camera_mode_office', 'recording') }}"
|
||||||
|
turn_on:
|
||||||
|
service: script.shinobi_active
|
||||||
|
turn_off:
|
||||||
|
service: script.shinobi_idle
|
Loading…
Reference in New Issue
Block a user