changes to home assistant, docker images, rustdesk relay

This commit is contained in:
2024-02-28 23:38:15 +01:00
parent 8650c3f6ee
commit c9e4ab6af0
15 changed files with 292 additions and 199 deletions

View File

@@ -24,7 +24,7 @@
action = {
service = "climate.set_hvac_mode";
target = {
entity_id = "climate.livingroom_ac";
entity_id = "climate.living_room";
};
data = {
hvac_mode = "off";
@@ -37,8 +37,8 @@
trigger = {
platform = "state";
entity_id = [
"climate.livingroom_ac"
"climate.bedroom_ac"
"climate.living_room"
"climate.bedroom"
];
to = [
"heat"
@@ -70,7 +70,7 @@
{
service = "climate.set_hvac_mode";
target = {
entity_id = "climate.bedroom_ac";
entity_id = "climate.bedroom";
};
data = {
hvac_mode = "cold";
@@ -93,7 +93,7 @@
action = {
service = "climate.set_hvac_mode";
target = {
entity_id = "climate.bedroom_ac";
entity_id = "climate.bedroom";
};
data = {
hvac_mode = "off";

View File

@@ -50,28 +50,28 @@
sensor_low_battery = {
name = "Sensor has low battery!";
message = ''
{%- set domains = ['sensor', 'battery'] -%}
{%- set threshold = 30 -%}
{%- set exclude_entities = ['sensor.sensors_lowest_battery_level','sensor.dominiks_iphone_battery_level'] -%}
{% set domains = ['sensor', 'battery'] %}
{% set threshold = 30 %}
{%- set exclude_entities = ['sensor.sensors_lowest_battery_level','sensor.dominiks_iphone_battery_level','sensor.roborock_s8_pro_ultra_battery'] -%}
Sensors are below 50% battery:
{%- for domain in domains -%}
{%- for item in states[domain] -%}
{%- if item.entity_id not in exclude_entities -%}
{%- if item.attributes.battery_level is defined -%}
{%- set level = item.attributes.battery_level|int -%}
{% for domain in domains %}
{% for item in states[domain] %}
{% if item.entity_id not in exclude_entities %}
{% if item.attributes.battery_level is defined %}
{% set level = item.attributes.battery_level|int %}
{% if level > 0 and level < threshold %}
- {{ item.attributes.friendly_name }} ({{ item.attributes['battery_level']|int}}%)
{%- endif -%}
{%- endif -%}
{%- if item.attributes.device_class is defined and item.attributes.device_class == 'battery' -%}
{%- set level = item.state|int -%}
{% endif %}
{% if item.attributes.device_class is defined and item.attributes.device_class == 'battery' %}
{% set level = item.state|int %}
{% if level > 0 and level <= threshold %}
- {{ item.attributes.friendly_name }} ({{ item.state|int }}%)
{%- endif -%}
{%- endif %}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
'';
entity_id = "binary_sensor.sensor_low_battery";
state = "on";

View File

@@ -99,7 +99,7 @@
];
}
{
conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.bathroom_light' }}" ];
conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.bathroom_lights' }}" ];
sequence = [
{
service = "light.turn_on";

View File

@@ -1,34 +1,43 @@
{
services.home-assistant.extraComponents = [
"ping"
"broadlink"
"androidtv"
"samsungtv"
];
services.home-assistant.config = {
# binary_sensor = [
# {
# name = "ps5_living";
# platform = "command_line";
# command = "python /var/lib/hass/ps5.py -q -b 10.42.96.176";
# device_class = "connectivity";
# scan_interval = 5;
# }
# {
# platform = "template";
# sensors = {
# multimedia_device_on = {
# friendly_name = "Any multimedia device on";
# device_class = "connectivity";
# value_template = ''
# {% if is_state('binary_sensor.ps5_living', 'on') or states('media_player.fire_tv_firetv_living_cloonar_com') != 'off' or states('device_tracker.xbox') == 'home' %}
# on
# {% else %}
# off
# {% endif %}
# '';
# };
# };
# }
# ];
binary_sensor = [
{
name = "xbox";
platform = "ping";
host = "xbox.cloonar.multimedia";
count = 1;
scan_interval = 2;
}
{
name = "ps5";
platform = "ping";
host = "ps5.cloonar.multimedia";
count = 1;
scan_interval = 2;
}
{
platform = "template";
sensors = {
multimedia_device_on = {
friendly_name = "Any multimedia device on";
device_class = "connectivity";
value_template = ''
{% if is_state('binary_sensor.ps5', 'on') or is_state('binary_sensor.xbox', 'on') or states('media_player.fire_tv_firetv_living_cloonar_multimedia') != 'off' %}
on
{% else %}
off
{% endif %}
'';
};
};
}
];
# "automation tv scene" = {
# alias = "auto tv scene";
# hide_entity = true;
@@ -76,8 +85,8 @@
hide_entity = true;
trigger = {
platform = "state";
entity_id = "device-tracker.xbox";
to = "home";
entity_id = "binary_sensor.xbox";
to = "on";
};
action = [
{
@@ -89,18 +98,18 @@
source = "Xbox";
};
}
{
delay = 5;
}
{
service = "denonavr.get_command";
target = {
entity_id = "media_player.marantz_sr6015";
};
data = {
command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY";
};
}
# {
# delay = 5;
# }
# {
# service = "denonavr.get_command";
# target = {
# entity_id = "media_player.marantz_sr6015";
# };
# data = {
# command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY";
# };
# }
];
};
"automation firetv on" = {
@@ -108,7 +117,7 @@
hide_entity = true;
trigger = {
platform = "state";
entity_id = "media_player.fire_tv_firetv_living_cloonar_com";
entity_id = "media_player.fire_tv_firetv_living_cloonar_multimedia";
from = "off";
};
action = [
@@ -121,52 +130,28 @@
command = "/goform/formiPhoneAppDirect.xml?SIMPLAY";
};
}
{
delay = 5;
}
];
};
"automation ps5 on" = {
alias = "ps5 on";
hide_entity = true;
trigger = {
platform = "state";
entity_id = "binary_sensor.ps5";
to = "on";
};
action = [
{
service = "denonavr.get_command";
target = {
entity_id = "media_player.marantz_sr6015";
};
data = {
command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY";
command = "/goform/formiPhoneAppDirect.xml?SIBD";
};
}
];
};
# "automation ps5 on" = {
# alias = "ps5 on";
# hide_entity = true;
# trigger = {
# platform = "state";
# entity_id = "binary_sensor.ps5_living";
# to = "on";
# };
# action = [
# {
# service = "denonavr.get_command";
# target = {
# entity_id = "media_player.marantz_sr6015";
# };
# data = {
# command = "/goform/formiPhoneAppDirect.xml?SIBD";
# };
# }
# {
# delay = 5;
# }
# {
# service = "denonavr.get_command";
# target = {
# entity_id = "media_player.marantz_sr6015";
# };
# data = {
# command = "/goform/formiPhoneAppDirect.xml?PWSTANDBY";
# };
# }
# ];
# };
"automation all multimedia off" = {
alias = "all multimedia off";
trigger = {
@@ -176,18 +161,10 @@
};
action = [
{
conditions = [ "{{ states('media_player.android_tv_metz_cloonar_com') != 'off'}}" ];
sequence = [
{
service = "androidtv.adb_command";
target = {
device_id = "a5e50f268f3a2dbd0741fb8e9ff7f931";
};
data = {
command = "POWER";
};
}
];
service = "media_player.turn_off";
target = {
entity_id = "media_player.android_tv_metz_cloonar_multimedia";
};
}
{
service = "denonavr.get_command";
@@ -212,47 +189,32 @@
conditions = [
{
condition = "state";
entity_id = "media_player.android_tv_metz_cloonar_com";
entity_id = "media_player.android_tv_metz_cloonar_multimedia";
state = "off";
}
{
condition = "state";
entity_id = "media_player.android_tv_metz_cloonar_com";
entity_id = "media_player.android_tv_metz_cloonar_multimedia";
state = "unavailable";
}
];
};
action = [
{
service = "androidtv.adb_command";
target = {
device_id = "a5e50f268f3a2dbd0741fb8e9ff7f931";
};
data = {
command = "POWER";
};
}
{
delay = 5;
}
{
choose = [
{
conditions = [
{
condition = "state";
entity_id = "media_player.android_tv_metz_cloonar_com";
entity_id = "media_player.android_tv_metz_cloonar_multimedia";
state = "off";
}
];
sequence = [
{
service = "androidtv.adb_command";
service = "media_player.turn_on";
target = {
device_id = "a5e50f268f3a2dbd0741fb8e9ff7f931";
};
data = {
command = "adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHDMI100004";
entity_id = "media_player.android_tv_metz_cloonar_multimedia";
};
}
];
@@ -261,7 +223,7 @@
conditions = [
{
condition = "state";
entity_id = "media_player.android_tv_metz_cloonar_com";
entity_id = "media_player.android_tv_metz_cloonar_multimedia";
state = "unavailable";
}
];
@@ -269,7 +231,7 @@
{
service = "remote.send_command";
target = {
device_id = "46988d2d424728f7355fe12b09e88e0e";
entity_id = "remote.rmproplus";
};
data = {
num_repeats = 1;
@@ -282,6 +244,18 @@
}
];
}
{
delay = 5;
}
{
service = "androidtv.adb_command";
target = {
entity_id = "media_player.android_tv_metz_cloonar_multimedia";
};
data = {
command = "adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHDMI100004";
};
}
];
};
# "automation multimedia input" = {

View File

@@ -12,7 +12,7 @@
action = {
service_template = "switch.turn_on";
data_template = {
entity_id = "switch.coffee_switch";
entity_id = "switch.coffee";
};
};
};
@@ -49,6 +49,10 @@
service = "light.turn_on";
entity_id = "light.bedroom_bed";
}
{
service = "switch.turn_off";
entity_id = "switch.coffee";
}
];
}
];