various tidyups

This commit is contained in:
root
2025-12-21 20:55:54 +13:00
parent 416efa6bd3
commit 19a14e1d1b
54 changed files with 5932 additions and 502 deletions
+12 -6
View File
@@ -20,10 +20,16 @@ mqtt:
unit_of_measurement: "kW"
value_template: "{{ value_json.ENERGY.Power[2] }}"
sensor:
- platform: template
sensors:
electricity_power_total:
friendly_name: "Electricity Power Total"
template:
- sensor:
- name: "Electricity Power Total"
unique_id: electricity_power_total
unit_of_measurement: "W"
value_template: "{{ states('sensor.tasmo_wemosd1_7280_powermon_1_energy_power_0') |float + states('sensor.tasmo_wemosd1_7280_powermon_1_energy_power_1') | float + states('sensor.tasmo_wemosd1_7280_powermon_1_energy_power_2') | float }}"
device_class: power
state_class: measurement
state: >
{{
states('sensor.tasmo_wemosd1_7280_powermon_1_energy_power_0') | float(0)
+ states('sensor.tasmo_wemosd1_7280_powermon_1_energy_power_1') | float(0)
+ states('sensor.tasmo_wemosd1_7280_powermon_1_energy_power_2') | float(0)
}}
+22 -16
View File
@@ -1,19 +1,25 @@
sensor:
- platform: template
sensors:
sensor_internet_downtraffic:
friendly_name: "Internet Download Traffic"
template:
- sensor:
- name: "Internet Download Traffic"
unique_id: internet_downtraffic
unit_of_measurement: "kB/s"
value_template: "{{ state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Received)') }}"
- platform: template
sensors:
sensor_internet_uptraffic:
friendly_name: "Internet Upload Traffic"
state_class: measurement
state: >
{{ state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Received)') | float(0) }}
- name: "Internet Upload Traffic"
unique_id: internet_uptraffic
unit_of_measurement: "kB/s"
value_template: "{{ state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Sent)') }}"
- platform: template
sensors:
sensor_internet_totaltraffic:
friendly_name: "Internet Total Traffic"
state_class: measurement
state: >
{{ state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Sent)') | float(0) }}
- name: "Internet Total Traffic"
unique_id: internet_totaltraffic
unit_of_measurement: "kB/s"
value_template: "{{ state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Received)') |float + state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Sent)') | float }}"
state_class: measurement
state: >
{{
(state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Received)') | float(0))
+ (state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Sent)') | float(0))
}}
+3 -3
View File
@@ -114,9 +114,9 @@ script:
light.esp_lounge6chdimmer_couch_spots_left: 20
light.esp_lounge6chdimmer_couch_spots_right: 20
#light.esp_lounge6chdimmer_dining_table_light: 100
light.esp_lounge6chdimmer_lounge_downlights_centre: 20
light.esp_lounge6chdimmer_lounge_downlights_south: 20
light.esp_lounge6chdimmer_lounge_rafter_buttons: 20
light.esp_lounge6chdimmer_lounge_downlights_centre: 10
light.esp_lounge6chdimmer_lounge_downlights_south: 30
light.esp_lounge6chdimmer_lounge_rafter_buttons: 0
light.esp_breakfastbarleds_breakfast_bar_leds: 40
light.esp_loungecabinetleds2_lounge_cabinet_leds: 40
light.esp_loungebookshelfleds_lounge_bookshelf_leds: 40
+76 -16
View File
@@ -1,20 +1,80 @@
sensor:
- platform: template
sensors:
devices_with_low_battery:
friendly_name: "Devices with low battery"
unit_of_measurement: devices
value_template: >-
{{ states.sensor
| selectattr('attributes.device_class', 'eq', 'battery')
| map(attribute='state')
| reject('in', ['unknown', 'unavailable', 'Ok'])
| map('int', -1) | select('le', 97)
| list | count
}}
icon_template: >-
{% if is_state('sensor.devices_with_low_battery', '0') %}
template:
- sensor:
- name: "Devices with low battery"
unique_id: devices_with_low_battery_count
unit_of_measurement: "devices"
state: >
{% set ns = namespace(c=0) %}
{% for s in states.sensor %}
{% if s.attributes.device_class == 'battery' %}
{% set st = s.state %}
{% if st not in ['unknown', 'unavailable', 'Ok'] %}
{% if st | int(-1) != -1 and (st | int(0)) <= 97 %}
{% set ns.c = ns.c + 1 %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{{ ns.c }}
icon: >
{% if this.state | int(0) == 0 %}
mdi:check-circle
{% else %}
mdi:battery-alert
{% endif %}
- name: "Devices with low battery list"
unique_id: devices_with_low_battery_list
icon: >
{% if states('sensor.devices_with_low_battery') | int(0) == 0 %}
mdi:check-circle
{% else %}
mdi:battery-alert
{% endif %}
state: >
{% set ns = namespace(names=[]) %}
{% for s in states.sensor %}
{% if s.attributes.device_class == 'battery' %}
{% set st = s.state %}
{% if st not in ['unknown', 'unavailable', 'Ok'] %}
{% if st | int(-1) != -1 and (st | int(0)) <= 97 %}
{% set ns.names = ns.names + [s.name ~ ' (' ~ (st | int(0)) ~ '%)'] %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% if ns.names | length == 0 %}
None
{% else %}
{{ ns.names | join(', ') }}
{% endif %}
attributes:
count: "{{ states('sensor.devices_with_low_battery') | int(0) }}"
entities: >
{% set ns = namespace(e=[]) %}
{% for s in states.sensor %}
{% if s.attributes.device_class == 'battery' %}
{% set st = s.state %}
{% if st not in ['unknown', 'unavailable', 'Ok'] %}
{% if st | int(-1) != -1 and (st | int(0)) <= 97 %}
{% set ns.e = ns.e + [s.entity_id] %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{{ ns.e }}
names: >
{% set ns = namespace(n=[]) %}
{% for s in states.sensor %}
{% if s.attributes.device_class == 'battery' %}
{% set st = s.state %}
{% if st not in ['unknown', 'unavailable', 'Ok'] %}
{% if st | int(-1) != -1 and (st | int(0)) <= 97 %}
{% set ns.n = ns.n + [s.name] %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{{ ns.n }}
+42
View File
@@ -0,0 +1,42 @@
automation:
- id: "1669966515993"
alias: Turn off Lounge TV
description: ""
trigger:
- platform: mqtt
topic: viewroad-commands/maintv/action
payload: "OFF"
condition: []
action:
- type: turn_off
device_id: 4a9f71fc64e158f1c9286d6e43ce782e
entity_id: remote.lounge_tv
domain: remote
mode: single
- id: tv_amp_follow_remote_state
alias: Lounge surround amp follows TV remote (5s debounce)
mode: restart
trigger:
- platform: state
entity_id: remote.lounge_tv
to: "on"
for: "00:00:05"
- platform: state
entity_id: remote.lounge_tv
to: "off"
for: "00:00:05"
action:
- choose:
- conditions:
- condition: state
entity_id: remote.lounge_tv
state: "on"
sequence:
- service: switch.turn_on
target:
entity_id: switch.tv_surround_amp_power_in_loft_x27pp
default:
- service: switch.turn_off
target:
entity_id: switch.tv_surround_amp_power_in_loft_x27pp
+53
View File
@@ -0,0 +1,53 @@
automation:
# Two lights and two switches for these corridor lights
- id: garage_entry_outside_2way_sync
alias: Garage Entry & Outside Light 2-Way Sync
initial_state: true
use_blueprint:
path: zorruno/two_three_way_sync.yaml
input:
members:
- switch.esp_garageentrylights_relay_1_corridor_lights
- switch.esp_loungesouthleftswitch_relay_2_outside_light_1
sync_on_start: true
startup_delay: 5
# Internal Garage Lights (Light controller is sonoff basic in cupboard)
- id: garage_lights_2way_sync
alias: Garage Lights 2-Way Sync
initial_state: true
use_blueprint:
path: zorruno/two_three_way_sync.yaml
input:
members:
- switch.esp_garageentrylights_relay_3_garage_lights
- switch.esp_garagelights_garage_lights
sync_on_start: true
startup_delay: 5
# Stair Lights Top
- id: stair_lights_top_2way_sync
alias: Stair lights Top Lights 2-Way Sync
initial_state: true
use_blueprint:
path: zorruno/two_three_way_sync.yaml
input:
members:
- switch.esp_centralstairs_top_relay_1_main_stair_lights
- switch.esp_centralstairs_bottom_relay_1_main_stair_lights_lower
- switch.esp_loungemiddleswitch_relay_3_downlights_north
sync_on_start: true
startup_delay: 5
# Stair Lights Bottom
- id: stair_footer_lights_2way_sync
alias: Stair Footer Lights 2-Way Sync
initial_state: true
use_blueprint:
path: zorruno/two_three_way_sync.yaml
input:
members:
- switch.esp_centralstairs_top_relay_2_stair_footer_lights
- switch.esp_centralstairs_bottom_relay_2_stair_footer_lights
sync_on_start: true
startup_delay: 5
+14 -36
View File
@@ -1,43 +1,21 @@
#nspanel_keepawake:
# name: Entities to keep NSPanel Awake
# unique_id: Entities_to_keep_NSPanel_Awake
# # Keeps the bedroom NSPanel Bright if any of these are true
# If 'all' is set to true, they are 'ANDed' otherwise 'ORd'
#all: true
# entities:
# - binary_sensor.inverted_quiet_time_sensor
# - light.tasmo_arlecrgb_3522_bulb_3
# - light.tasmo_ifan02_3793_bedrm1_1
# - light.tasmo_ks811t_3647_bedrm1_1b
#light:
# - platform: template
# sensors:
# inverted_quiet_time_sensor:
# value_template: >-
# {{ is_state('input_boolean.quiet_time', 'off') }}
# #device_class: None
# friendly_name: Quiet Time (Inverted)
template:
- light:
- name: "Inverted Quiet time as light"
unique_id: inverted_quiet_time_as_light
state: "{{ is_state('input_boolean.quiet_time', 'off') }}"
turn_on:
- service: light.turn_on
target:
entity_id: light.inverted_quiet_time_light
turn_off:
- service: light.turn_off
target:
entity_id: light.inverted_quiet_time_light
light:
- platform: template
lights:
inverted_quiet_time_as_light:
friendly_name: "Inverted Quiet time as light"
unique_id: "inverted quiet time as light"
value_template: "{{ is_state('input_boolean.quiet_time', 'off') }}"
turn_on:
service: light.turn_on
target:
entity_id: light.inverted_quiet_time_light
turn_off:
service: light.turn_off
target:
entity_id: light.inverted_quiet_time_as_light
- platform: group
name: "Entities to keep NSPanel Awake"
unique_id: "Entities to keep NSPanel Awake"
unique_id: "Entities to keep_nspanel_awake"
entities:
- light.inverted_quiet_time_as_light
- light.tasmo_arlecrgb_3522_bulb_3
+5 -5
View File
@@ -22,7 +22,7 @@ automation:
to: "on"
condition:
condition: state
entity_id: switch.esp_poollightpower_power_output
entity_id: switch.esp_poollightpower2_switch
state: "off"
action:
- service: mqtt.publish
@@ -37,7 +37,7 @@ automation:
to: "off"
condition:
condition: state
entity_id: switch.esp_poollightpower_power_output
entity_id: switch.esp_poollightpower2_switch
state: "on"
action:
- service: mqtt.publish
@@ -68,12 +68,12 @@ automation:
- alias: "Pool Lights → sync UI switch with real output (no MQTT)"
trigger:
platform: state
entity_id: switch.esp_poollightpower_power_output
entity_id: switch.esp_poollightpower2_switch
action:
- choose:
- conditions:
- condition: state
entity_id: switch.esp_poollightpower_power_output
entity_id: switch.esp_poollightpower2_switch
state: "on"
sequence:
- service: input_boolean.turn_on
@@ -84,7 +84,7 @@ automation:
entity_id: input_boolean.timer_light_midnight_pending
- conditions:
- condition: state
entity_id: switch.esp_poollightpower_power_output
entity_id: switch.esp_poollightpower2_switch
state: "off"
sequence:
- service: input_boolean.turn_off
+89 -99
View File
@@ -1,79 +1,131 @@
mqtt:
sensor:
- state_topic: "viewroad-status/rpis/cctvquad1/cpu-temp"
- unique_id: cctvquad1_cpu_temp
state_topic: "viewroad-status/rpis/cctvquad1/cpu-temp"
name: "CCTVQuad1 CPU Temperature"
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
value_template: "{{ value | float(0) }}"
icon: mdi:thermometer
- state_topic: "viewroad-status/rpis/cctvquad1/cpu-use"
- unique_id: cctvquad1_cpu_use
state_topic: "viewroad-status/rpis/cctvquad1/cpu-use"
name: "CCTVQuad1 CPU Use"
unit_of_measurement: "%"
state_class: measurement
value_template: "{{ value | float(0) }}"
icon: mdi:cpu-32-bit
- state_topic: "viewroad-status/rpis/cctvquad1/ram-use"
- unique_id: cctvquad1_ram_use
state_topic: "viewroad-status/rpis/cctvquad1/ram-use"
name: "CCTVQuad1 RAM Use"
unit_of_measurement: "%"
state_class: measurement
value_template: "{{ value | float(0) }}"
icon: mdi:raspberry-pi
- state_topic: "viewroad-status/rpis/cctvquad1/disk-use"
- unique_id: cctvquad1_disk_use
state_topic: "viewroad-status/rpis/cctvquad1/disk-use"
name: "CCTVQuad1 Disk Use"
unit_of_measurement: "%"
state_class: measurement
value_template: "{{ value | float(0) }}"
icon: mdi:harddisk
- state_topic: "viewroad-status/rpis/cctvquad1/uptime"
- unique_id: cctvquad1_uptime
state_topic: "viewroad-status/rpis/cctvquad1/uptime"
name: "CCTVQuad1 Uptime"
icon: mdi:timer
- state_topic: "viewroad-status/rpis/cctvquad1/last-seen"
- unique_id: cctvquad1_last_seen
state_topic: "viewroad-status/rpis/cctvquad1/last-seen"
name: "CCTVQuad1 Last Seen"
icon: mdi:calendar-clock
- state_topic: "viewroad-status/rpis/cctvquad1/ipv4-address"
- unique_id: cctvquad1_ipv4_address
state_topic: "viewroad-status/rpis/cctvquad1/ipv4-address"
name: "CCTVQuad1 IPv4 Address"
icon: mdi:server-network
- state_topic: "viewroad-status/rpis/cctvquad2/cpu-temp"
- unique_id: cctvquad2_cpu_temp
state_topic: "viewroad-status/rpis/cctvquad2/cpu-temp"
name: "CCTVQuad2 CPU Temperature"
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
value_template: "{{ value | float(0) }}"
icon: mdi:thermometer
- state_topic: "viewroad-status/rpis/cctvquad2/cpu-use"
- unique_id: cctvquad2_cpu_use
state_topic: "viewroad-status/rpis/cctvquad2/cpu-use"
name: "CCTVQuad2 CPU Use"
unit_of_measurement: "%"
state_class: measurement
value_template: "{{ value | float(0) }}"
icon: mdi:cpu-32-bit
- state_topic: "viewroad-status/rpis/cctvquad2/ram-use"
- unique_id: cctvquad2_ram_use
state_topic: "viewroad-status/rpis/cctvquad2/ram-use"
name: "CCTVQuad2 RAM Use"
unit_of_measurement: "%"
state_class: measurement
value_template: "{{ value | float(0) }}"
icon: mdi:raspberry-pi
- state_topic: "viewroad-status/rpis/cctvquad2/disk-use"
- unique_id: cctvquad2_disk_use
state_topic: "viewroad-status/rpis/cctvquad2/disk-use"
name: "CCTVQuad2 Disk Use"
unit_of_measurement: "%"
state_class: measurement
value_template: "{{ value | float(0) }}"
icon: mdi:harddisk
- state_topic: "viewroad-status/rpis/cctvquad2/uptime"
- unique_id: cctvquad2_uptime
state_topic: "viewroad-status/rpis/cctvquad2/uptime"
name: "CCTVQuad2 Uptime"
icon: mdi:timer
- state_topic: "viewroad-status/rpis/cctvquad2/last-seen"
- unique_id: cctvquad2_last_seen
state_topic: "viewroad-status/rpis/cctvquad2/last-seen"
name: "CCTVQuad2 Last Seen"
icon: mdi:calendar-clock
- state_topic: "viewroad-status/rpis/cctvquad2/ipv4-address"
- unique_id: cctvquad2_ipv4_address
state_topic: "viewroad-status/rpis/cctvquad2/ipv4-address"
name: "CCTVQuad2 IPv4 Address"
icon: mdi:server-network
switch:
- name: "CCTVQuad1 Reboot"
- unique_id: cctvquad1_reboot
name: "CCTVQuad1 Reboot"
state_topic: "viewroad-status/rpis/cctvquad1/reboot"
command_topic: "viewroad-commands/rpis/cctvquad1/reboot/set"
qos: 1
optimistic: false
retain: false
icon: mdi:refresh
- name: "CCTVQuad1 Shutdown"
- unique_id: cctvquad1_shutdown
name: "CCTVQuad1 Shutdown"
state_topic: "viewroad-status/rpis/cctvquad1/shutdown"
command_topic: "viewroad-commands/rpis/cctvquad1/shutdown/set"
qos: 1
optimistic: false
retain: false
icon: mdi:close-network
- name: "CCTVQuad2 Reboot"
- unique_id: cctvquad2_reboot
name: "CCTVQuad2 Reboot"
state_topic: "viewroad-status/rpis/cctvquad2/reboot"
command_topic: "viewroad-commands/rpis/cctvquad2/reboot/set"
qos: 1
optimistic: false
retain: false
icon: mdi:refresh
- name: "CCTVQuad2 Shutdown"
- unique_id: cctvquad2_shutdown
name: "CCTVQuad2 Shutdown"
state_topic: "viewroad-status/rpis/cctvquad2/shutdown"
command_topic: "viewroad-commands/rpis/cctvquad2/shutdown/set"
qos: 1
@@ -81,29 +133,25 @@ mqtt:
retain: false
icon: mdi:close-network
binary_sensor:
- platform: template
sensors:
pi_cctvquad1_on:
friendly_name: "CCTV Quad1 Available"
value_template: >-
{%- if states( 'sensor.cctvquad1_last_seen' ) != 'unknown'
and ( as_timestamp( now() ) - as_timestamp( states( 'sensor.cctvquad1_last_seen' ) ) ) <= 180 -%}
True
{%- else -%}
False
{%- endif %}
- platform: template
sensors:
pi_cctvquad2_on:
friendly_name: "CCTV Quad2 Available"
value_template: >-
{%- if states( 'sensor.cctvquad2_last_seen' ) != 'unknown'
and ( as_timestamp( now() ) - as_timestamp( states( 'sensor.cctvquad2_last_seen' ) ) ) <= 180 -%}
True
{%- else -%}
False
{%- endif %}
template:
- binary_sensor:
- name: "CCTV Quad1 Available"
unique_id: pi_cctvquad1_on
device_class: connectivity
state: >
{% set now_ts = as_timestamp(now()) %}
{% set last_ts = as_timestamp(states('sensor.cctvquad1_last_seen'), default=0) %}
{% set age = now_ts - last_ts %}
{{ last_ts > 0 and age >= 0 and age <= 180 }}
- name: "CCTV Quad2 Available"
unique_id: pi_cctvquad2_on
device_class: connectivity
state: >
{% set now_ts = as_timestamp(now()) %}
{% set last_ts = as_timestamp(states('sensor.cctvquad2_last_seen'), default=0) %}
{% set age = now_ts - last_ts %}
{{ last_ts > 0 and age >= 0 and age <= 180 }}
group:
pi_cctvquad1_on:
@@ -133,61 +181,3 @@ group:
- sensor.cctvquad2_ram_use
- sensor.cctvquad2_disk_use
- sensor.cctvquad2_last_seen
#automation:
# - alias: "Home Assistant Start"
# trigger:
# platform: homeassistant
# event: start
# action:
# - service: group.set_visibility
# entity_id:
# - group.pi_cctvquad1_on
# data:
# visible: False
# - alias: "pi is on"
# trigger:
# platform: state
# entity_id:
# - binary_sensor.pi_cctvquad1_on
# from: "off"
# to: "on"
# action:
# - service: group.set_visibility
# data_template:
# entity_id: "group.pi_{{ trigger.entity_id | replace( 'binary_sensor.pi_', '' ) }}"
# visible: True
# - service: group.set_visibility
# data_template:
# entity_id: "group.pi_{{ trigger.entity_id | replace( 'binary_sensor.pi_', '' ) | replace( '_on', '' ) }}_off"
# visible: False
# - alias: "pi not seen"
# trigger:
# platform: state
# entity_id:
# - binary_sensor.pi_cctvquad1_on
# from: "on"
# to: "off"
# action:
# - service: group.set_visibility
# data_template:
# entity_id: "group.pi_{{ trigger.entity_id | replace( 'binary_sensor.pi_', '' ) | replace( '_on', '' ) }}_on"
# visible: False
# - service: group.set_visibility
# data_template:
# entity_id: "group.pi_{{ trigger.entity_id | replace( 'binary_sensor.pi_', '' ) | replace( '_on', '' ) }}_off"
# visible: True
#- service: notify.ios_PHONENAME
#data_template:
#title: "Pi Offline"
#message: "{{ trigger.entity_id | replace( 'binary_sensor.pi_', '' ) | replace( '_on', '' ) }}"
#- alias: 'pi disk use'
#trigger:
#platform: numeric_state
#entity_id:
#- sensor.cctvquad1_disk_use
#above: 90
#action:
#- service: notify.ios_PHONENAME
#data_template:
#title: "Pi Disk Use > 90%"
#message: "{{ trigger.entity_id | replace( 'sensor.', '' ) | replace( '_disk_use', '' ) }}"
+6 -3
View File
@@ -10,6 +10,9 @@ group:
- switch.esp_mainkitchenlights_relay_1_main_lights
- switch.esp_mainkitchenlights_relay_2_benchtop_lights
- switch.main_hallway_lightswitch_tasmo_ks811s_2940_hallway_1a
- switch.tasmo_ks811t_0702_lounge_3a
- switch.tasmo_ks811t_0702_lounge_3b
- switch.tasmo_ks811t_0702_lounge_3c
- light.esp_lounge6chdimmer_lounge_downlights_centre
- light.esp_lounge6chdimmer_lounge_downlights_south
- light.esp_lounge6chdimmer_lounge_rafter_buttons
- light.esp_loungepelmetleds2_lounge_pelmet_leds_a
- light.esp_lounge6chdimmer_couch_spots_left
- light.esp_lounge6chdimmer_couch_spots_right
+23
View File
@@ -0,0 +1,23 @@
#############################################
# HOME ASSISTANT SYSTEM UPTIME SENSORS
# V1.2 2025-11-26
# - System Monitor removed from YAML (must be added via UI)
# - Template sensors only
#############################################
#############################################
# TEMPLATE SENSORS (Home Assistant Core uptime)
#############################################
template:
- sensor:
- name: Home Assistant Core Uptime
unique_id: ha_core_uptime_seconds
icon: mdi:timer-outline
unit_of_measurement: seconds
state: >
{% set start = states('sensor.uptime') %}
{% if start in ['unknown', 'unavailable', 'none', ''] %}
unknown
{% else %}
{{ (as_timestamp(now()) - as_timestamp(start)) | int }}
{% endif %}
+12 -7
View File
@@ -1,8 +1,13 @@
sensor:
- platform: template
sensors:
weewx_wind_bearing_template:
value_template: >
template:
- sensor:
- name: "Weewx Wind Bearing"
unique_id: weewx_wind_bearing_template
state: >
{% set direction = ['N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW','N'] %}
{% set degree = states('sensor.weewx_wind_direction')|float %}
{{ direction[((degree+11.25)/22.5)|int] }}
{% set degree = states('sensor.weewx_wind_direction') | float(none) %}
{% if degree is not none %}
{% set d = (degree % 360) %}
{{ direction[((d + 11.25) / 22.5) | int] }}
{% else %}
unknown
{% endif %}
+70 -61
View File
@@ -3,136 +3,145 @@ mqtt:
- unique_id: weewx_windSpeed_kph
state_topic: "weewx/windSpeed_kph"
name: "Weewx Wind Speed"
unit_of_measurement: "kph"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "km/h"
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:weather-windy-variant"
- unique_id: weewx_windGust_kph
state_topic: "weewx/windGust_kph"
name: "Weewx Wind Gust"
unit_of_measurement: "kph"
value_template: "{{ value | round(1) }}"
icon: "mdi:outTemp_C"
unit_of_measurement: "km/h"
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:weather-windy"
- unique_id: weewx_outTemp_C
state_topic: "weewx/outTemp_C"
name: "Weewx Outdoor Temperature"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value | round(1) }}"
device_class: temperature
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:thermometer"
- unique_id: weewx_inTemp_C
state_topic: "weewx/inTemp_C"
name: "Weewx Indoor Temperature"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value | round(1) }}"
device_class: temperature
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:thermometer"
- unique_id: weewx_humidex_C
state_topic: "weewx/humidex_C"
name: "Weewx Humidex"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value | round(1) }}"
device_class: temperature
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:thermometer"
- unique_id: weewx_dewpoint_C
state_topic: "weewx/dewpoint_C"
name: "Weewx Dewpoint"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value | round(1) }}"
device_class: temperature
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:thermometer"
- unique_id: weewx_heatindex_C
state_topic: "weewx/heatindex_C"
name: "Weewx Heat Index"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value | round(1) }}"
device_class: temperature
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:thermometer"
- unique_id: weewx_windchill_C
state_topic: "weewx/windchill_C"
name: "Weewx Windchill"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value | round(1) }}"
device_class: temperature
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:thermometer"
- unique_id: weewx_outHumidity
state_topic: "weewx/outHumidity"
name: "Weewx Outdoor Humidity"
unit_of_measurement: "%"
value_template: "{{ value | round(1) }}"
device_class: humidity
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:water-percent"
- unique_id: weewx_inHumidity
state_topic: "weewx/inHumidity"
name: "Weewx Indoor Humidity"
unit_of_measurement: "%"
value_template: "{{ value | round(1) }}"
device_class: humidity
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:water-percent"
- unique_id: weewx_barometer_mbar
state_topic: "weewx/barometer_mbar"
name: "Weewx Air Pressure"
unit_of_measurement: "mbar"
value_template: "{{ value | round(3) }}"
name: "Weewx Barometer"
unit_of_measurement: "hPa"
device_class: pressure
state_class: measurement
value_template: "{{ value | float(0) | round(3) }}"
icon: "mdi:gauge"
- unique_id: weewx_altimeter_mbar
state_topic: "weewx/altimeter_mbar"
name: "Weewx Air Pressure"
unit_of_measurement: "mbar"
value_template: "{{ value | round(3) }}"
name: "Weewx Altimeter Pressure"
unit_of_measurement: "hPa"
device_class: pressure
state_class: measurement
value_template: "{{ value | float(0) | round(3) }}"
icon: "mdi:gauge"
- unique_id: weewx_windDir
state_topic: "weewx/windDir"
name: "Weewx Wind Direction"
unit_of_measurement: "degrees"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "deg"
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:compass"
- unique_id: weewx_windGustDir
state_topic: "weewx/windGustDir"
name: "Weewx Wind Gust Direction"
unit_of_measurement: "degrees"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "deg"
state_class: measurement
value_template: "{{ value | float(0) | round(1) }}"
icon: "mdi:compass"
- unique_id: weewx_rainRate_cm_per_hour
state_topic: "weewx/rainRate_cm_per_hour"
name: "Weewx Rain Rate"
unit_of_measurement: "cm/hour"
value_template: "{{ value | round(4) }}"
unit_of_measurement: "cm/h"
state_class: measurement
value_template: "{{ value | float(0) | round(4) }}"
icon: "mdi:weather-rainy"
- unique_id: weewx_rain_cm
state_topic: "weewx/rain_cm"
name: "Weewx Rain Now"
unit_of_measurement: "cm"
value_template: "{{ value | round(4) }}"
state_class: measurement
value_template: "{{ value | float(0) | round(4) }}"
icon: "mdi:weather-rainy"
- unique_id: weewx_hourRain_cm
state_topic: "weewx/hourRain_cm"
name: "Weewx Hourly Rain"
unit_of_measurement: "cm"
value_template: "{{ value | round(4) }}"
state_class: measurement
value_template: "{{ value | float(0) | round(4) }}"
icon: "mdi:weather-rainy"
- unique_id: weewx_dayRain_cm
state_topic: "weewx/dayRain_cm"
name: "Weewx Daily Rain"
unit_of_measurement: "cm"
value_template: "{{ value | round(4) }}"
icon: "mdi:weather-rainy"
- unique_id: weewx_rain24_cm
state_topic: "weewx/rain24_cm"
name: "Weewx 24 Hour Rain"
unit_of_measurement: "cm"
value_template: "{{ value | round(4) }}"
icon: "mdi:weather-rainy"
- unique_id: weewx_rainTotal
state_topic: "weewx/rainTotal"
name: "Weewx Rain Total"
unit_of_measurement: "cm"
value_template: "{{ value | multiply(0.3937) | round(4) }}"
icon: "mdi:weather-rainy"
- unique_id: weewx_dateTime
state_topic: "weewx/dateTime"
name: "WeeWX Timestamp"
unit_of_measurement: "s"
value_template: "{{ value }}"
- unique_id: weewx_irxCheckPercent
state_topic: "weewx/rxCheckPercent"
name: "WeeWX Receive Quality"
unit_of_measurement: "%"
value_template: "{{ value }}"