Skip to content

Instantly share code, notes, and snippets.

@andrew-codechimp
Last active March 14, 2023 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrew-codechimp/d7a304279121d8043e2da397c15c7575 to your computer and use it in GitHub Desktop.
Save andrew-codechimp/d7a304279121d8043e2da397c15c7575 to your computer and use it in GitHub Desktop.
EsphoMatrix Automation Examples
alias: Pixel Clock Andrew Buttons
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.esphpixelclock01_middle_button
id: middle_button
to: "on"
condition: []
action:
- service: switch.toggle
data: {}
target:
entity_id: switch.esphpixelclock01_display
mode: single
alias: Office Andrew - Pixel Display Presence
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.andrew_office_active
condition: []
action:
- if:
- condition: state
entity_id: binary_sensor.andrew_office_active
state: "on"
then:
- service: switch.turn_on
data: {}
target:
entity_id: switch.esphpixelclock01_display
else:
- service: switch.turn_off
data: {}
target:
entity_id: switch.esphpixelclock01_display
mode: single
alias: Post Notification
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.z2maqarareed01_contact
to: "on"
from: "off"
condition:
- condition: template
value_template: >-
{{ (as_timestamp(now()) -
as_timestamp(state_attr('automation.post_notification', 'last_triggered')
| default(0)) | int > 120) }}
action:
- service: esphome.esphpixelclock01_screen
data:
icon_name: envelope
text: You have post
- service: esphome.esphpixelclock01_force_screen
data:
icon_name: envelope
mode: single
alias: Pixel Clock Andrew Screens
description: ""
trigger:
- platform: time_pattern
seconds: "1"
id: minute
alias: One Minute Time Trigger Pattern
- platform: state
entity_id:
- media_player.office_andrew
attribute: media_title
id: media
- platform: state
entity_id:
- sensor.transmission_completed_torrents
- sensor.transmission_total_torrents
id: transmission
- platform: state
entity_id:
- binary_sensor.esphpixelclock01_status
from: unavailable
to: "on"
id: connected
condition:
- condition: not
conditions:
- condition: state
entity_id: switch.esphpixelclock01_display
state: unavailable
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: trigger
id: minute
- condition: trigger
id: connected
sequence:
- service: esphome.esphpixelclock01_screen
data:
icon_name: temperature_highc
text: "{{ states('sensor.average_temperature') | round(1) }}"
alias: Internal Temperature
- service: esphome.esphpixelclock01_screen
data:
icon_name: mastodon
text: "{{ states('sensor.codechimp_mastodon_online_follower_count') }}"
alias: Mastodon Followers
- service: esphome.esphpixelclock01_del_screen
data:
icon_name: w_*
alias: Delete Weather
- service: esphome.esphpixelclock01_screen
data:
icon_name: >-
{% set mapper = {
'sunny' : 'w_sun',
'clear, night' : 'w_moon',
'partly cloudy' : 'w_partcloudd',
'partlycloudy' : 'w_partcloudd',
'mist' : 'w_fog',
'fog' : 'w_fog',
'cloudy' : 'w_cloud',
'overcast' : 'w_cloud',
'rainy' : 'w_rainlight',
'pouring' : 'w_rainheavy',
'sleet' : 'w_hail',
'hail' : 'w_hail',
'snowy' : 'w_snowy',
'snowy, rainy' : 'w_snowy',
'thunder' : 'w_thunder'
} %} {% set weather_state =
states('sensor.ipswich_weather_3_hourly') %} {{
mapper[weather_state] if weather_state in mapper else
'w_unknown' }}
text: >-
{{ states('sensor.ipswich_weather_3_hourly') }} {{
states('sensor.z2mhueoutdoormotion01_temperature') | round(1)
}}{{ state_attr('sensor.z2mhueoutdoormotion01_temperature',
'unit_of_measurement') }}
alias: Weather
- if:
- condition: not
conditions:
- condition: state
entity_id: sensor.transmission_total_torrents
state: unknown
- condition: numeric_state
entity_id: sensor.transmission_total_torrents
above: 0
then:
- service: esphome.esphpixelclock01_screen
data:
icon_name: transmission
text: >-
{{ states('sensor.transmission_total_torrents') }} Torrents
{{ states('sensor.transmission_down_speed') }}{{
state_attr('sensor.transmission_down_speed','unit_of_measurement')
}}
enabled: true
alias: Transmission
- conditions:
- condition: trigger
id: media
sequence:
- service: esphome.esphpixelclock01_screen
data:
icon_name: musical_notes
text: "{{ state_attr('media_player.office_andrew', 'media_title') }}"
- conditions:
- condition: trigger
id: transmission
- condition: not
conditions:
- condition: state
entity_id: sensor.transmission_total_torrents
state: unavailable
sequence:
- service: esphome.esphpixelclock01_screen
data:
icon_name: transmission
text: >-
{{ states('sensor.transmission_total_torrents') }} Torrents {{
states('sensor.transmission_down_speed') }}{{
state_attr('sensor.transmission_down_speed','unit_of_measurement')
}}
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment