Skip to content

Commit

Permalink
Integrate Awtrix clocks
Browse files Browse the repository at this point in the history
  • Loading branch information
golles committed Nov 4, 2023
1 parent d0d259d commit 2500fb3
Show file tree
Hide file tree
Showing 9 changed files with 476 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ Some general scripts are in the [scripts](scripts.yaml) file.

I've created a few [blueprints](blueprints/automation/golles/) to repeat logic in different rooms or for different devices.

| Blueprint | Summary |
| ---------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| [Doow/window climate control](blueprints/automation/golles/door-window-climate-control.yaml) | Turn on/off a climate entity when a door/window opens/closes |
| [Motion activated scenes](blueprints/automation/golles/motion-activated_scenes.yaml) | Turn on lights (by scene) based on motion |
| [Aqara magic cube (zigbee2mqtt)](blueprints/automation/golles/zigbee2mqtt_aqara_magic_cube.yaml) | Blueprint to control a Aqara magic cube |
| [Bed light button (Hue smart button, zigbee2mqtt)](blueprints/automation/golles/zigbee2mqtt_hue_smart_button_bed_light_button.yaml) | Bed button, single click for bed light, long click for ceiling light |
| [Button press and hold (Hue smart button, zigbee2mqtt)](blueprints/automation/golles/zigbee2mqtt_hue_smart_button_press_and_hold_actions.yaml) | Blueprint for Hue buttons that support press and hold |
| [Xiaomi switches (zigbee2mqtt)](blueprints/automation/golles/zigbee2mqtt_xiaomi_switch.yaml) | Blueprint for several Xiaomi switches |
| Blueprint | Summary |
| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| [Awtrix clock](blueprints/automation/golles/awtrix_clock.yaml) | Manage display on/off state and device apps from Home Assistant states |
| [Doow/window climate control](blueprints/automation/golles/door-window-climate-control.yaml) | Turn on/off a climate entity when a door/window opens/closes |
| [Motion activated scenes](blueprints/automation/golles/motion-activated_scenes.yaml) | Turn on lights (by scene) based on motion |
| [Aqara magic cube (zigbee2mqtt)](blueprints/automation/golles/zigbee2mqtt_aqara_magic_cube.yaml) | Blueprint to control a Aqara magic cube |
| [Bed light button (Hue smart button, zigbee2mqtt)](blueprints/automation/golles/zigbee2mqtt_hue_smart_button_bed_light_button.yaml) | Bed button, single click for bed light, long click for ceiling light |
| [Button press and hold (Hue smart button, zigbee2mqtt)](blueprints/automation/golles/zigbee2mqtt_hue_smart_button_press_and_hold_actions.yaml) | Blueprint for Hue buttons that support press and hold |
| [Xiaomi switches (zigbee2mqtt)](blueprints/automation/golles/zigbee2mqtt_xiaomi_switch.yaml) | Blueprint for several Xiaomi switches |

If you like any of these blueprints, then you can import these into your own Home Assistant.
[Report an issue with a blueprint](https://github.com/golles/Home-Assistant-Config/issues/new?assignees=&labels=blueprint&projects=&template=blueprint.yaml).
Expand Down
11 changes: 11 additions & 0 deletions automations/logeerkamer/klok.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- id: logeerkamer_awtrix_klok
alias: Logeerkamer Awtrix klok
use_blueprint:
path: golles/awtrix_clock.yaml
input:
light_entity: light.logeerkamer_klok_matrix
topic: awtrix_b92250
button_entity: binary_sensor.logeerkamer_klok_button_select
temp_entity: sensor.logeerkamer_temperature
weather_entity: weather.knmi_purmerend
occupancy_entity: binary_sensor.logeerkamer_bezetting
11 changes: 11 additions & 0 deletions automations/woonkamer/klok.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- id: woonkamer_awtrix_klok
alias: Woonkamer Awtrix klok
use_blueprint:
path: golles/awtrix_clock.yaml
input:
light_entity: light.woonkamer_klok_matrix
topic: awtrix_b861cc
button_entity: binary_sensor.woonkamer_klok_button_select
temp_entity: sensor.woonkamer_temperature
weather_entity: weather.knmi_purmerend
occupancy_entity: binary_sensor.woonkamer_bezetting
141 changes: 141 additions & 0 deletions blueprints/automation/golles/awtrix_clock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
blueprint:
name: Awtrix clock
description: |
### Overview
This blueprint offers comprehensive control for Awtrix clocks, boasting the following functionalities:
- Automatically toggle the display based on room occupancy.
- Convenient manual display control via a button.
- Display informative apps, including:
- Real-time room temperature.
- External temperature with weather-dependent icons.
### Weather Icons
Get a variety of weather icons on your clock by running my [awtrix](https://github.com/golles/Home-Assistant-Config/blob/main/scripts/awtrix) script.
### Extra scripts
A variety of extra scripts can be found in my [awtrix](https://github.com/golles/Home-Assistant-Config/blob/main/packages/awtrix.yaml) package.
domain: automation
author: golles
source_url: https://raw.githubusercontent.com/golles/Home-Assistant-Config/main/blueprints/automation/golles/awtrix_clock.yaml
input:
topic:
selector:
text: null
name: Topic
description: The device mqtt topic
default: awtrix_XXXXXX
light_entity:
selector:
entity:
domain: light
integration: mqtt
name: Display entity
description: The device display entity
default: light.awtrix_matrix
button_entity:
selector:
entity:
domain: binary_sensor
integration: mqtt
name: Middle button
description: The device middle button, to toggle the screen
default: binary_sensor.awtrix_button_select
temp_entity:
selector:
entity:
domain: sensor
device_class: temperature
name: Temperature entity
description: Used for inside temperature
default: sensor.room_temperature
weather_entity:
selector:
entity:
domain: weather
name: Weather entity
description: Used for outisde temperature
default: weather.home
occupancy_entity:
selector:
entity:
domain: binary_sensor
device_class: occupancy
name: Room occupancy sensor
description: Turn display automatically on or off depending on occupancy
default: binary_sensor.room_occupancy

mode: parallel
max_exceeded: silent

trigger:
- platform: state
id: button_click
entity_id: !input button_entity
to: "on"
- platform: state
id: occupancy_on
entity_id: !input occupancy_entity
to: "on"
- platform: state
id: occupancy_off
entity_id: !input occupancy_entity
to: "off"
for:
minutes: 10
- platform: state
id: apps
entity_id:
- !input temp_entity
- !input weather_entity

action:
- variables:
topic: !input topic
button_entity: !input button_entity
light_entity: !input light_entity
temp_entity: !input temp_entity
weather_entity: !input weather_entity

- choose:
- conditions: "{{ trigger.id == 'button_click' }}"
sequence:
- alias: Toggle display
service: light.toggle
target:
entity_id: "{{ light_entity }}"

- conditions: "{{ trigger.id == 'occupancy_on' }}"
sequence:
- alias: Turn display on
service: light.turn_on
target:
entity_id: "{{ light_entity }}"

- conditions: "{{ trigger.id == 'occupancy_off' }}"
sequence:
- alias: Turn display off
service: light.turn_off
target:
entity_id: "{{ light_entity }}"

- conditions: "{{ trigger.id == 'apps' }}"
sequence:
- alias: Update apps
service: mqtt.publish
data:
topic: "{{ topic }}/custom/pages"
payload: >-
{{
[
dict(
text = states(temp_entity) | round ~ state_attr(temp_entity, "unit_of_measurement"),
icon = "temp-inside",
),
dict(
text = state_attr(weather_entity, "temperature") | round ~ state_attr(weather_entity, "temperature_unit"),
icon = states(weather_entity),
)
] | to_json
}}
10 changes: 10 additions & 0 deletions lovelace/views/logeerkamer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ cards:
name: Laptop (werk)
icon: mdi:laptop

- type: tile
entity: light.logeerkamer_klok_matrix
name: Klok
state_content: state
icon_tap_action:
action: call-service
service: script.awtrix_default_settings
data:
topic: awtrix_b92250

- type: vertical-stack
cards:
- type: custom:mushroom-title-card
Expand Down
9 changes: 9 additions & 0 deletions lovelace/views/woonkamer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ cards:
- type: tile
entity: media_player.woonkamer_homepod_mini
name: Homepod mini
- type: tile
entity: light.woonkamer_klok_matrix
name: Klok
state_content: state
icon_tap_action:
action: call-service
service: script.awtrix_default_settings
data:
topic: awtrix_b92250

- type: vertical-stack
cards:
Expand Down
176 changes: 176 additions & 0 deletions packages/awtrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
script:
awtrix_default_settings:
alias: Awtrix standaard instellingen
mode: parallel
fields:
topic:
selector:
text: null
name: Topic
description: The device mqtt topic
default: awtrix_XXXXXX
required: true
sequence:
- alias: Switch app
service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ topic }}/switch"
payload: >-
{"name": "Time"}
- alias: Set settings
service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ topic }}/settings"
payload: >-
{
"WD": true,
"TIME_COL": [255, 255, 255],
"TMODE": 1,
"ABRI": true,
"ATRANS": true,
"ATIME": 60,
"TEFF": 1
}
awtrix_night_clock:
alias: Awtrix nachtklok
mode: parallel
fields:
topic:
selector:
text: null
name: Topic
description: The device mqtt topic
default: awtrix_XXXXXX
required: true
sequence:
- alias: Switch app
service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ topic }}/switch"
payload: >-
{"name": "Time"}
- alias: Set settings
service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ topic }}/settings"
payload: >-
{
"WD": false,
"TIME_COL": [255, 0, 0],
"TMODE": 0,
"BRI": 1,
"ABRI": false,
"ATRANS": false
}
awtrix_set_effect:
alias: Awtrix zet effect
mode: parallel
fields:
topic:
selector:
text: null
name: Topic
description: The device mqtt topic
default: awtrix_XXXXXX
required: true
effect:
selector:
select:
mode: list
options:
- BrickBreaker
- Checkerboard
- Fireworks
- PingPong
- Radar
- Ripple
- Snake
- TwinklingStars
- TheaterChase
- ColorWaves
- SwirlOut
- SwirlIn
- LookingEyes
- Matrix
- Pacifica
- Plasma
- PlasmaCloud
- MovingLine
name: Effect
description: "The effects which should be displayed. See: https://blueforcer.github.io/awtrix-light/#/effects"
default: Matrix
required: true
duration:
selector:
number:
min: 1
max: 999
mode: slider
unit_of_measurement: seconds
name: Effect duration
description: Select how long each effect should be displayed.
default: 600
required: true
sequence:
- alias: Set effect
service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ topic }}/custom/effect"
payload: >-
{
"effect": "{{ effect }}",
"duration": "{{ duration }}"
}
- alias: Switch app
service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ topic }}/switch"
payload: >-
{"name": "effect"}
- alias: Wait a little
delay:
seconds: "{{ duration }}"

- alias: Remove effect
service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ topic }}/custom/effect"

awtrix_remove_effect:
alias: Awtrix verwijder effect
mode: parallel
fields:
topic:
selector:
text: null
name: Topic
description: The device mqtt topic
default: awtrix_XXXXXX
required: true
sequence:
- alias: Remove effect
service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ topic }}/custom/effect"
Loading

0 comments on commit 2500fb3

Please sign in to comment.