Skip to content

Commit

Permalink
Update to new template format
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarb committed Jan 22, 2023
1 parent 38985c0 commit cf82b55
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,30 +128,23 @@ mqtt:
payload_off: "screenOff"
json_attributes_topic: fully/deviceInfo/#

- platform: template
sensors:
hallway_motion:
friendly_name: "Hallway motion sensor"
value_template: >-
{{ is_state('binary_sensor.mqtt_hallway_motion', 'on')
or (is_state('binary_sensor.mqtt_hallway_motion', 'unavailable') and is_state('switch.hallway_motion_sensor', 'on')) }}

- platform: template
sensors:
macbook_pro:
friendly_name: "MacBook Pro active"
value_template: >-
- name: Hallway motion
device_class: motion
state: >
{{ is_state('binary_sensor.mqtt_hallway_motion', 'on')
or (is_state('binary_sensor.mqtt_hallway_motion', 'unavailable') and is_state('switch.hallway_motion_sensor', 'on')) }}
- name: MacBook Pro
state: >
{{ is_state('binary_sensor.macbook_pro_active', 'on')
or is_state('binary_sensor.macbook_pro_active_work', 'on')
}}
- platform: template
sensors:
macbook_pro_at_desk:
friendly_name: "MacBook Pro at desk"
value_template: >-
- name: MacBook Pro at desk
state: >
{{ not is_state('sensor.macbook_pro_internal_battery_state', 'Not Charging') }}

# Switches
switch:
Expand Down

0 comments on commit cf82b55

Please sign in to comment.