Skip to content

Instantly share code, notes, and snippets.

@parisbutterfield
Created May 19, 2019 22:49
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 parisbutterfield/9151757985953d683633b98e543d3ae3 to your computer and use it in GitHub Desktop.
Save parisbutterfield/9151757985953d683633b98e543d3ae3 to your computer and use it in GitHub Desktop.
switch:
- platform: mqtt
name: "Bedroom Fan"
state_topic: "ha/switch/bedroom_fan/state"
command_topic: "ha/switch/bedroom_fan/set"
payload_on: "on"
payload_off: "off"
optimistic: false
qos: 0
retain: true
- platform: mqtt
name: "Bathroom Light"
state_topic: "ha/switch/bathroom_light/state"
command_topic: "ha/switch/bathroom_light/set"
payload_on: "on"
payload_off: "off"
optimistic: false
qos: 0
retain: true
- platform: mqtt
name: "Kitchen Light"
state_topic: "ha/switch/kitchen_light/state"
command_topic: "ha/switch/kitchen_light/set"
payload_on: "on"
payload_off: "off"
optimistic: false
qos: 0
retain: true
- platform: mqtt
name: "Dining Table"
state_topic: "ha/switch/dining_table/state"
command_topic: "ha/switch/dining_table/set"
payload_on: "on"
payload_off: "off"
optimistic: false
qos: 0
retain: true
- platform: mqtt
name: "Living Room Fan"
state_topic: "ha/switch/living_room_fan/state"
command_topic: "ha/switch/living_room_fan/set"
payload_on: "on"
payload_off: "off"
optimistic: false
qos: 0
retain: true
mqtt_statestream:
base_topic: ha
publish_attributes: true
publish_timestamps: true
automation:
- alias: 'Kitchen Light Automation'
trigger:
platform: mqtt
topic: ha/switch/kitchen_light/set
action:
service_template: >
{% if trigger.payload == 'on' %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
entity_id: switch.kitchen_light
- alias: 'Living Room Fan Automation'
trigger:
platform: mqtt
topic: ha/switch/living_room_fan/set
action:
service_template: >
{% if trigger.payload == 'on' %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
entity_id: switch.living_room_fan
- alias: 'Dining Room Light Automation'
trigger:
platform: mqtt
topic: ha/switch/dining_table/set
action:
service_template: >
{% if trigger.payload == 'on' %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
entity_id: switch.dining_table
switch:
- platform: switchmate
name: 'Living Room Fan'
mac: '<>'
scan_interval: 60
- platform: switchmate
name: 'Kitchen Light'
mac: '<>'
scan_interval: 60
- platform: switchmate
name: 'Dining Table'
mac: '<>'
scan_interval: 60
mqtt_statestream:
base_topic: ha
publish_attributes: true
publish_timestamps: true
automation:
- alias: 'Bedroom Fan Automation'
trigger:
platform: mqtt
topic: ha/switch/bedroom_fan/set
action:
service_template: >
{% if trigger.payload == 'on' %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
entity_id: switch.bedroom_fan
- alias: 'Bathroom Light Automation'
trigger:
platform: mqtt
topic: ha/switch/bathroom_light/set
action:
service_template: >
{% if trigger.payload == 'on' %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
entity_id: switch.bathroom_light
switch:
- platform: switchmate
name: 'Bedroom Fan'
mac: '<>'
scan_interval: 60
- platform: switchmate
name: 'Bathroom Light'
mac: '<>'
scan_interval: 60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment