Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Latest commit

 

History

History
24 lines (20 loc) · 540 Bytes

README.md

File metadata and controls

24 lines (20 loc) · 540 Bytes

Mqtt template switch

Based on standard mqtt switch component with templateble properties:

payload_on
payload_off

Each of them can contains template

Example:

switch:
  - platform: mqtt_template
    name: laundry-fan
    state_topic: "home/bathroom/switch/laundry-fan/state"
    command_topic: "home/bathroom/switch/laundry-fan"
    payload_on: '{"action":"hold","duration": {{(states.input_number.fan_duration.state
        | int)*1000}}}'
    payload_off: '{"action":"off"}'
    state_on: 1
    state_off: 0