Permalink
Browse files

HASP v0.31

  • Loading branch information...
aderusha committed Dec 5, 2018
1 parent 9f70f0e commit 9cdc288db4e15d9b6f86bfba78d82b3636a56f5d
@@ -0,0 +1,18 @@
automation:
##############################################################################
# Auto update firmware at 3:00am every day if a new version is available
- alias: hasp_plate01_00_AutoFirmwareUpdate
trigger:
- platform: time
at: '3:00:00'
condition:
- condition: template
value_template: '{{ states.sensor.plate01_status.attributes.updateESPAvailable == true }}'
- condition: state
entity_id: 'binary_sensor.plate01_connected'
state: 'on'
action:
- service: mqtt.publish
data_template:
topic: 'hasp/plate01/command/espupdate'
payload: ''
@@ -0,0 +1,24 @@
automation:
##############################################################################
# Set backlight based on sun elevation according to following:
# elevation > 10 == backlight 255
# elevation -10 to 10 == backlight 20 to 255
# elevation below -10 == backlight 20
- alias: hasp_plate01_00_BacklightBySun
trigger:
- platform: time
# Matches every minute
seconds: 00
condition:
- condition: template
value_template: '{{ states.sun.sun.attributes.elevation <= 10 }}'
- condition: template
value_template: '{{ states.sun.sun.attributes.elevation >= -10 }}'
- condition: state
entity_id: 'binary_sensor.plate01_connected'
state: 'on'
action:
- service: mqtt.publish
data:
topic: 'hasp/plate01/brightness/set'
payload_template: "{% if state_attr('sun.sun', 'elevation') >= 10 -%}255{% elif (state_attr('sun.sun', 'elevation') < 10) and (state_attr('sun.sun', 'elevation') > -10) %}{{ ((state_attr('sun.sun', 'elevation') + 10) * 12.5) | int + 5 }}{% else %}5{%- endif %}"
@@ -0,0 +1,49 @@
##############################################################################
# Template sensors to report Kodi media player activity by @squirtbrnr
sensor:
- platform: template
sensors:
media_player_kodi_title:
friendly_name: Title
value_template: >-
{%- if states.media_player.kodi.state == "playing" or "paused" -%}
{%- if states.media_player.kodi.attributes.media_content_type == "tvshow" -%}
S{%- if states.media_player.kodi.attributes.media_season < 10 -%}0{%- endif -%}{{ states.media_player.kodi.attributes.media_season }}E{%- if states.media_player.kodi.attributes.media_episode < 10 -%}0{%- endif -%}{{ states.media_player.kodi.attributes.media_episode }} - {{ states.media_player.kodi.attributes.media_title }}
{%- else -%}
{{ states.media_player.kodi.attributes.media_title }}
{%- endif -%}
{%- else -%}
{%- endif -%}
icon_template: mdi:television-classic
media_player_kodi_artist:
friendly_name: Series
value_template: >-
{%- if states.media_player.kodi.state == "playing" or "paused" and states.media_player.kodi.attributes.media_content_type == "tvshow" -%}
{{ states.media_player.kodi.attributes.media_series_title }}
{%- else -%}
{%- endif -%}
icon_template: mdi:television-classic
media_player_kodi_volume:
friendly_name: Volume
value_template: >-
{%- if states.media_player.kodi.attributes.volume_level -%}
{{ states.media_player.kodi.attributes.volume_level * 100}}
{%- else -%}
0
{%- endif -%}
unit_of_measurement: '%'
icon_template: >-
{%- if 66 < states.media_player.kodi.attributes.volume_level * 100 <= 100 -%}
mdi:volume-high
{%- elif 33 < states.media_player.kodi.attributes.volume_level * 100 <= 66 -%}
mdi:volume-medium
{%- elif 0 < states.media_player.kodi.attributes.volume_level * 100 <= 33 -%}
mdi:volume-low
{%- elif states.media_player.kodi.attributes.volume_level * 100 == 0 -%}
mdi:volume-off
{%- else -%}
mdi:volume-mute
{%- endif -%}
@@ -0,0 +1,131 @@
##############################################################################
# Automations and required components to display information messages on HASP
input_text:
hasp_plate01_messagetext:
name: plate01 Message Text
icon: mdi:playlist-edit
max: 126
hasp_plate01_messageqr:
name: plate01 Message QR
icon: mdi:qrcode-edit
max: 47
input_number:
hasp_plate01_messagetime:
name: plate01 Message Time
icon: mdi:clock-end
mode: box
min: 1
max: 600
step: 1
group:
plate01_messagedisplay:
name: plate01 Message Display
view: no
entities:
- input_text.hasp_plate01_messagetext
- input_text.hasp_plate01_messageqr
- input_number.hasp_plate01_messagetime
- automation.hasp_plate01_00_messagedisplaytext
- automation.hasp_plate01_00_messagedisplayqr
- automation.hasp_plate01_00_messagedisplaytextqr
automation:
##############################################################################
# Display text message only
- alias: hasp_plate01_00_messagedisplaytext
trigger: []
action:
- service: mqtt.publish
data_template:
topic: 'hasp/plate01/command/p[0].b[1].txt'
payload: '"{{ states.input_text.hasp_plate01_messagetext.state }}"'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command/page'
payload: '0'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command'
payload: 'vis 3,0'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command'
payload: 'vis 1,1'
- delay: '00:00:{{ states.input_number.hasp_plate01_messagetime.state | int }}'
- service: mqtt.publish
data_template:
topic: 'hasp/plate01/command/page'
payload: '{{ states.input_number.hasp_plate01_activepage.state | int }}'
##############################################################################
# Display qr message only
- alias: hasp_plate01_00_messagedisplayqr
trigger: []
action:
- service: mqtt.publish
data_template:
topic: 'hasp/plate01/command/p[0].b[3].txt'
payload: '"{{ states.input_text.hasp_plate01_messageqr.state }}"'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command/page'
payload: '0'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command'
payload: 'vis 1,0'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command'
payload: 'vis 3,1'
- delay: '00:00:{{ states.input_number.hasp_plate01_messagetime.state | int }}'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command'
payload: 'vis 3,0'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command'
payload: 'vis 1,1'
- service: mqtt.publish
data_template:
topic: 'hasp/plate01/command/page'
payload: '{{ states.input_number.hasp_plate01_activepage.state | int }}'
##############################################################################
# Display text and qr message
- alias: hasp_plate01_00_messagedisplaytextqr
trigger: []
action:
- service: mqtt.publish
data_template:
topic: 'hasp/plate01/command/p[0].b[1].txt'
payload: '"{{ states.input_text.hasp_plate01_messagetext.state }}"'
- service: mqtt.publish
data_template:
topic: 'hasp/plate01/command/p[0].b[3].txt'
payload: '"{{ states.input_text.hasp_plate01_messageqr.state }}"'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command/page'
payload: '0'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command'
payload: 'vis 1,1'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command'
payload: 'vis 3,1'
- delay: '00:00:{{ states.input_number.hasp_plate01_messagetime.state | int }}'
- service: mqtt.publish
data:
topic: 'hasp/plate01/command'
payload: 'vis 3,0'
- service: mqtt.publish
data_template:
topic: 'hasp/plate01/command/page'
payload: '{{ states.input_number.hasp_plate01_activepage.state | int }}'
Binary file not shown.

0 comments on commit 9cdc288

Please sign in to comment.