How to setup a switch template to call some services
See original GitHub issueGood day ! to begin with, I want to express my deep gratitude to the developers of the add-on , xiaomi_airpurifier , and express hope that the project will continue to develop!
now about the topic of the post:
according to the instructions in README.md I installed the add-on , xiaomi_airpurifier , and set up the Air Humidifier MJJSQ .
after studying the post
unsuccessfully trying to add on / off lights, need your help.
here is my configuration.yaml file
fan:
- platform: xiaomi_miio_airpurifier
name: Xiaomi Air Humidifier
host: 192.168.1.191
token: e23dfbcf44f8aeea9e82d409c9c21e2b
model: deerma.humidifier.mjjsq
sensor:
- platform: template
sensors:
airpurifier_led:
friendly_name: Air Purifier led Index
value_template: '{{ states.fan.xiaomi_air_humidifier.attributes.led }}'
airhumidifier_temperature:
friendly_name: Air Humidifier Temperature
value_template: '{{ states.fan.xiaomi_air_humidifier.attributes.temperature }}'
unit_of_measurement: '°C'
airhumidifier_humidity:
friendly_name: Air Humidifier Humidity
value_template: '{{ states.fan.xiaomi_air_humidifier.attributes.humidity }}'
unit_of_measurement: '%'
airhumidifier_mode:
friendly_name: Air Humidifier mode
value_template: '{{ states.fan.xiaomi_air_humidifier.attributes.mode }}'
airhumidifier_target_humidity:
friendly_name: Air Humidifier Target Humidity
value_template: '{{ states.fan.xiaomi_air_humidifier.attributes.target_humidity }}'
unit_of_measurement: '%'
airhumidifier_model:
friendly_name: Air Humidifier model
value_template: '{{ states.fan.xiaomi_air_humidifier.attributes.model }}'
here is an example of what I am trying to modify
switch:
- platform: template
switches:
xiaomi_airpurifier_led:
friendly_name: "LED"
value_template: "{{ is_state_attr('fan.xiaomi_miio_device', 'led', true) }}"
turn_on:
service: xiaomi_miio.fan_set_led_on
data:
entity_id: fan.xiaomi_miio_device
turn_off:
service: xiaomi_miio.fan_set_led_off
data:
entity_id: fan.xiaomi_miio_device
icon_template: "mdi:lightbulb-outline"
Issue Analytics
- State:
- Created 3 years ago
- Comments:28 (16 by maintainers)
Top Results From Across the Web
Using a switch to call a service - Home Assistant Community
Instructions on how to setup scripts within Home Assistant. A template switch could also work. Home Assistant. Template Switch.
Read more >Interface Templates [Cisco IOS 15.2E] - Configuration Guides
Enables multilayer switching configurations. This command is available on the following devices in template configuration mode:.
Read more >Templates for Switching Best Practices - Cisco Meraki
Create a new switch network. · Add devices to the network as normal. · Navigate to Organization > Configuration templates > Template name....
Read more >Switching templates in version 7.0 - Squarespace Help Center
This guide covers how to switch templates on version 7.0. ... Some changes that you make to a template preview affect your live...
Read more >Command-line switches for Microsoft Office products
Make a switch available for reuse by creating a shortcut ... a read-only copy of a document that is stored on a Microsoft...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please try this one:
The
target_humidity
attribute is exposed as template sensor here. So we can monitor the state of the sensor.@4ertik131 The
target_humidity
is available now if you update the custom component to thedevelop
branch.