Last active
October 10, 2022 22:02
-
-
Save Deraen/c3ed58350e742fae424feb4a680261be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
X=$1 | |
if [[ -z $X ]]; then | |
read X | |
fi | |
if [[ $X == "status" ]]; then | |
if [[ $(SWAYSOCK=$(systemctl --user show-environment | grep ^SWAYSOCK | cut -d'=' -f2) swaymsg -r -t get_outputs | jq ".[0].dpms") == "true" ]]; then | |
echo ON | |
else | |
echo OFF | |
fi | |
elif [[ $X == "off" ]]; then | |
pkill -USR1 swayidle | |
else | |
systemctl --user start idle-wake | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch: | |
- platform: command_line | |
scan_interval: 5 | |
switches: | |
display_power: | |
command_on: 'echo on | ssh -T -o StrictHostKeyChecking=no -i /config/ha_key juho@juho-desktop' | |
command_off: 'echo off | ssh -T -o StrictHostKeyChecking=no -i /config/ha_key juho@juho-desktop' | |
command_state: 'echo status | ssh -T -o StrictHostKeyChecking=no -i /config/ha_key juho@juho-desktop' | |
value_template: '{{ value == "ON" }}' | |
friendly_name: juho-desktop.display_power | |
unique_id: juho-desktop.display_power |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: TV valot | |
description: "" | |
trigger: | |
- platform: state | |
entity_id: | |
- media_player.tv | |
not_to: | |
- unknown | |
for: | |
seconds: 5 | |
condition: [] | |
action: | |
- choose: | |
- conditions: "{{ trigger.to_state.state == 'on' }}" | |
sequence: | |
- service: scene.create | |
data: | |
scene_id: tv_valot_revert | |
snapshot_entities: light.yleisvalo,light.sohvapoyta,switch.display_power | |
- service: switch.turn_off | |
target: | |
entity_id: switch.display_power | |
data: {} | |
- service: light.turn_off | |
target: | |
entity_id: light.yleisvalo | |
data: {} | |
- service: light.turn_off | |
target: | |
entity_id: light.sohvapoyta | |
data: {} | |
default: | |
- service: scene.turn_on | |
target: | |
entity_id: scene.tv_valot_revert | |
data: {} | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment