Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 34 lines (33 sloc) 1.42 KB
##############################################################################
# Automations to display the weather forecast and current temp on page 2
automation:
# Display weather details on page 2 when weather updates or on HASP init
- alias: hasp_plate01_p2_Weather
trigger:
- platform: state
entity_id: weather.met_no
- platform: state
entity_id: 'binary_sensor.plate01_connected'
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: 'binary_sensor.plate01_connected'
state: 'on'
action:
- service: mqtt.publish
data:
topic: 'hasp/plate01/command/p[2].b[6].font'
payload: '3'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command/p[2].b[6].txt'
payload_template: '"{{state_attr("weather.met_no","temperature")|int}}°F"'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command/p[2].b[7].font'
payload_template: '{% if states.weather.met_no.state|length <= 6 -%}3{% elif (states.weather.met_no.state|length > 6) and (states.weather.met_no.state|length <= 10) %}2{% elif (states.weather.met_no.state|length > 10) and (states.weather.met_no.state|length <= 15) %}1{% else %}0{%- endif %}'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command/p[2].b[7].txt'
payload_template: '"{{states.weather.met_no.state|wordwrap(20, wrapstring="\\r")|title}}"'
You can’t perform that action at this time.