163 lines
3.3 KiB
YAML
163 lines
3.3 KiB
YAML
|
###############################################################################
|
||
|
# @author : Jeffrey Stone
|
||
|
# @date : 02/19/2019
|
||
|
# @package : Weekday
|
||
|
# @description : Weekday Sensor for use as a condition in automations and scripts
|
||
|
###############################################################################
|
||
|
|
||
|
sensor:
|
||
|
- platform: mqtt
|
||
|
name: weekday
|
||
|
state_topic: "house/week/day"
|
||
|
|
||
|
script:
|
||
|
monday:
|
||
|
sequence:
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: house/week/day
|
||
|
payload: mon
|
||
|
retain: true
|
||
|
tuesday:
|
||
|
sequence:
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: house/week/day
|
||
|
payload: tue
|
||
|
retain: true
|
||
|
wednesday:
|
||
|
sequence:
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: house/week/day
|
||
|
payload: wed
|
||
|
retain: true
|
||
|
thursday:
|
||
|
sequence:
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: house/week/day
|
||
|
payload: thu
|
||
|
retain: true
|
||
|
friday:
|
||
|
sequence:
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: house/week/day
|
||
|
payload: fri
|
||
|
retain: true
|
||
|
saturday:
|
||
|
sequence:
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: house/week/day
|
||
|
payload: sat
|
||
|
retain: true
|
||
|
sunday:
|
||
|
sequence:
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: house/week/day
|
||
|
payload: sun
|
||
|
retain: true
|
||
|
|
||
|
automation:
|
||
|
- alias: set weekday mon
|
||
|
initial_state: true
|
||
|
trigger:
|
||
|
- platform: time
|
||
|
at: 00:00:01
|
||
|
- platform: homeassistant
|
||
|
event: start
|
||
|
condition:
|
||
|
- condition: time
|
||
|
weekday:
|
||
|
- mon
|
||
|
action:
|
||
|
- service: script.monday
|
||
|
id: set_weekday_mon
|
||
|
- alias: set weekday tue
|
||
|
initial_state: true
|
||
|
trigger:
|
||
|
- platform: time
|
||
|
at: 00:00:01
|
||
|
- platform: homeassistant
|
||
|
event: start
|
||
|
condition:
|
||
|
- condition: time
|
||
|
weekday:
|
||
|
- tue
|
||
|
action:
|
||
|
- service: script.tuesday
|
||
|
id: set_weekday_tue
|
||
|
- alias: set weekday wed
|
||
|
initial_state: true
|
||
|
trigger:
|
||
|
- platform: time
|
||
|
at: 00:00:01
|
||
|
- platform: homeassistant
|
||
|
event: start
|
||
|
condition:
|
||
|
- condition: time
|
||
|
weekday:
|
||
|
- wed
|
||
|
action:
|
||
|
- service: script.wednesday
|
||
|
id: set_weekday_wed
|
||
|
- alias: set weekday thu
|
||
|
initial_state: true
|
||
|
trigger:
|
||
|
- platform: time
|
||
|
at: '00:00:01'
|
||
|
- platform: homeassistant
|
||
|
event: start
|
||
|
condition:
|
||
|
- condition: time
|
||
|
weekday:
|
||
|
- thu
|
||
|
action:
|
||
|
- service: script.thursday
|
||
|
id: set_weekday_thu
|
||
|
- alias: set weekday fri
|
||
|
initial_state: true
|
||
|
trigger:
|
||
|
- platform: time
|
||
|
at: '00:00:01'
|
||
|
- platform: homeassistant
|
||
|
event: start
|
||
|
condition:
|
||
|
- condition: time
|
||
|
weekday:
|
||
|
- fri
|
||
|
action:
|
||
|
- service: script.friday
|
||
|
id: set_weekday_fri
|
||
|
- alias: set weekday sat
|
||
|
initial_state: true
|
||
|
trigger:
|
||
|
- platform: time
|
||
|
at: '00:00:01'
|
||
|
- platform: homeassistant
|
||
|
event: start
|
||
|
condition:
|
||
|
- condition: time
|
||
|
weekday:
|
||
|
- sat
|
||
|
action:
|
||
|
- service: script.saturday
|
||
|
id: set_weekday_sat
|
||
|
- alias: set weekday sun
|
||
|
initial_state: true
|
||
|
trigger:
|
||
|
- platform: time
|
||
|
at: '00:00:01'
|
||
|
- platform: homeassistant
|
||
|
event: start
|
||
|
condition:
|
||
|
- condition: time
|
||
|
weekday:
|
||
|
- sun
|
||
|
action:
|
||
|
- service: script.sunday
|
||
|
id: set_weekday_sun
|