Closed 4ertik131 closed 3 years ago
Could you inspect your home-assistant.log and provide the error messages?
error messages do not appear! (both in the log and in pop-up messages)
when you press the button ,, led ,, nothing happens. (no response from humidifier)
configuration.yaml
switch:
# Xiaomi Air Purifier 2S
- 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_airpurifier.fan_set_led_on
data:
entity_id: fan.xiaomi_miio_device
turn_off:
service: xiaomi_miio_airpurifier.fan_set_led_off
data:
entity_id: fan.xiaomi_miio_device
icon_template: "mdi:lightbulb-outline"
Plese replace "true" with "True". This template switch works for my air purifier:
switch:
- platform: template
switches:
xiaomi_airpurifier_led:
friendly_name: "LED"
value_template: "{{ is_state_attr('fan.air_purifier_2', 'led', True) }}"
turn_on:
service: xiaomi_miio_airpurifier.fan_set_led_on
data:
entity_id: fan.air_purifier_2
turn_off:
service: xiaomi_miio_airpurifier.fan_set_led_off
data:
entity_id: fan.air_purifier_2
icon_template: "mdi:lightbulb-outline"
Plese replace "true" with "True". This template switch works for my air purifier:
switch: - platform: template switches: xiaomi_airpurifier_led: friendly_name: "LED" value_template: "{{ is_state_attr('fan.air_purifier_2', 'led', True) }}" turn_on: service: xiaomi_miio_airpurifier.fan_set_led_on data: entity_id: fan.air_purifier_2 turn_off: service: xiaomi_miio_airpurifier.fan_set_led_off data: entity_id: fan.air_purifier_2 icon_template: "mdi:lightbulb-outline"
fixed, still does not work.
how to find out the correct entity_id: ???? for my device.
Just browse this list: http://localhost:8123/developer-tools/state
hurray, it worked!
switch:
#
- platform: template
switches:
xiaomi_airpurifier_led:
friendly_name: "LED"
value_template: "{{ is_state_attr('fan.xiaomi_air_humidifier', 'led', True) }}"
turn_on:
service: xiaomi_miio_airpurifier.fan_set_led_on
data:
entity_id: fan.xiaomi_air_humidifier
turn_off:
service: xiaomi_miio_airpurifier.fan_set_led_off
data:
entity_id: fan.xiaomi_air_humidifier
icon_template: "mdi:lightbulb-outline"
Thank you for your help, I will add all the buttons and switches to the config in this topic.
If you like, you could setup templates for every feature of your device. A target humidify slider would be nice.
If you like, you could setup templates for every feature of your device. A target humidify slider would be nice.
do you have an example configuration.yaml with configured humidify slider (0 ... 90% humidity) and mode slider (Low, Medium, High, Humidity)?
I added a mode slider (Low, Medium, High, Humidity) but so far I can not get it to work
input_select:
#
airhumidifier_mode:
name: "Mode"
options:
- Low
- Medium
- High
- Humidity
icon: "mdi:animation-outline"
i tried changing airhumidifier_mode: xiaomi_airpurifier_mode: speed_list:
You could adopt this one: https://community.home-assistant.io/t/xiaomi-mi-wifi-plug-air-purifier/16189/372
This works for my air purifier entity:
input_select:
airpurifier_mode:
name: Mode
options:
- Auto
- Silent
- Favorite
- Idle
automation:
- id: xiaomi_mode
alias: Xiaomi Mode
trigger:
platform: state
entity_id: input_select.airpurifier_mode
action:
- service: fan.set_speed
data_template:
entity_id: fan.air_purifier_2
speed: '{{ states.input_select.airpurifier_mode.state }}'
Это работает для моего очистителя воздуха:
input_select: airpurifier_mode: name: Mode options: - Auto - Silent - Favorite - Idle automation: - id: xiaomi_mode alias: Xiaomi Mode trigger: platform: state entity_id: input_select.airpurifier_mode action: - service: fan.set_speed data_template: entity_id: fan.air_purifier_2 speed: '{{ states.input_select.airpurifier_mode.state }}'
thanks for the example! I improved it to get an update online (when switching modes mechanically on the humidifier itself, the mode status in the Homeassistant changes)
input_select: airpurifier_mode: name: Mode options: - Low - Medium - High - Humidity
i started setting target_humidity and faced such problem - target_humidity does not display values. possible error in the code?
airhumidifier_target_humidity:
friendly_name: Air Humidifier Target Humidity
value_template: '{{ states.fan.xiaomi_air_humidifier.attributes.target_humidity }}'
unit_of_measurement: '%'
target_humidity item is not in fan.xiaomi_air_humidifier
i tested for both jsq1 and mjjsq
Are you able to control the target_humidity
in general via the service? Just the feedback (attribute) is missing for both devices?
@4ertik131 The target_humidity
is available now if you update the custom component to the develop
branch.
@ 4ertik131 Теперь
target_humidity
доступен, если вы обновите пользовательский компонент вdevelop
ветке.
thanks. everything works, i tested on both humidifiers.
@syssi do you have a use case for the service? xiaomi_miio_airpurifier.fan_set_target_humidity
Do you like to provide an input_slider
or input_select
example to control the target humidity? I would like to add it to the docs.
@syssi input_slider the best thing
Вы хотели бы предоставить ли
input_slider
илиinput_select
пример для управления целевой влажности? Хочу добавить в документацию.Do you like to provide an
input_slider
orinput_select
example to control the target humidity? I would like to add it to the docs.
cheerful morning !
there is news about adding use cases xiaomi_miio_airpurifier.fan_set_target_humidity ? all my attempts to use examples from internet search have failed :weary:
Could you tell me the supported target humidities (30
, 40
, 50
,...) of your devices?
Please adopt this example for your needs:
input_number:
airpurifier_favorite_level:
name: Favorite Level
initial: 1
min: 0
max: 16
step: 1
automation:
- alias: Airpurifier Favorite Level Slider
trigger:
platform: state
entity_id: input_number.airpurifier_favorite_level
action:
- service: xiaomi_miio_airpurifier.fan_set_favorite_level
data_template:
entity_id: fan.air_purifier_2
level: '{{ states.input_number.airpurifier_favorite_level.state }}'
Your feedback loop is missing in this example.
If've added a full-featured input number example to the docs: https://github.com/syssi/xiaomi_airpurifier#input-number-example
You want to use the xiaomi_miio_airpurifier.fan_set_target_humidity
service instead an monitor the target_humidity
attribute.
I think this configuration should to the job:
input_number:
airhumidifier_target_humidity:
name: Target humidity
min: 0
max: 99
step: 1
automation:
- alias: Select target humidity by slider
trigger:
platform: state
entity_id: input_number.airhumidifier_target_humidity
action:
- service: xiaomi_miio_airpurifier.fan_set_target_humidity
data_template:
entity_id: fan.xiaomi_air_humidifier
humidity: '{{ states.input_number.airhumidifier_target_humidity.state|int }}'
- alias: Monitor target humidity and update slider
trigger:
platform: state
entity_id: fan.xiaomi_air_humidifier
action:
service: input_number.set_value
entity_id: input_number.airhumidifier_target_humidity
data_template:
value: '{{ states.fan.xiaomi_air_humidifier.attributes.target_humidity }}'
Я думаю, что эта конфигурация должна работать:
input_number: airhumidifier_target_humidity: name: Target humidity min: 0 max: 99 step: 1 automation: - alias: Select target humidity by slider trigger: platform: state entity_id: input_number.airhumidifier_target_humidity action: - service: xiaomi_miio_airpurifier.fan_set_target_humidity data_template: entity_id: fan.xiaomi_air_humidifier humidity: '{{ states.input_number.airhumidifier_target_humidity.state|int }}' - alias: Monitor target humidity and update slider trigger: platform: state entity_id: fan.xiaomi_air_humidifier action: service: input_number.set_value entity_id: input_number.airhumidifier_target_humidity data_template: value: '{{ states.fan.xiaomi_air_humidifier.attributes.target_humidity }}'
Thank you very much for the work done.
I needed time to check everything on two humidifiers.
everything works correctly except for feedback.
the feedback is not responsive.
platform: state
entity_id: fan.xiaomi_air_humidifier
The trigger isn't correct. We are monitoring the state
of the device. We should monitor the target humidity attribute instead.
platform: state entity_id: fan.xiaomi_air_humidifier
Триггер неправильный. Мы следим за работой
state
устройства. Вместо этого мы должны контролировать целевой атрибут влажности.
alias: Monitor target humidity and update slider
trigger:
platform: state
entity_id:
#sensor.airhumidifier_target_humidity
#input_number.airhumidifier_target_humidity
#fan.xiaomi_air_humidifier
I've tried these options. no one works. no feedback(
Please try this one:
sensor:
- platform: template
sensors:
airhumidifier_target_humidity:
friendly_name: Target humidity
value_template: '{{ states.fan.xiaomi_air_humidifier.attributes.target_humidity }}'
unit_of_measurement: '%'
icon_template: mdi:water-percent
input_number:
airhumidifier_target_humidity:
name: Target humidity
min: 0
max: 99
step: 1
automation:
- alias: Select target humidity by slider
trigger:
platform: state
entity_id: input_number.airhumidifier_target_humidity
action:
- service: xiaomi_miio_airpurifier.fan_set_target_humidity
data_template:
entity_id: fan.xiaomi_air_humidifier
humidity: '{{ states.input_number.airhumidifier_target_humidity.state|int }}'
- alias: Monitor target humidity and update slider
trigger:
platform: state
entity_id: sensor.airhumidifier_target_humidity
action:
service: input_number.set_value
entity_id: input_number.airhumidifier_target_humidity
data_template:
value: '{{ states.fan.xiaomi_air_humidifier.attributes.target_humidity }}'
The target_humidity
attribute is exposed as template sensor here. So we can monitor the state of the sensor.
Примерьте вот это:
sensor: - platform: template sensors: airhumidifier_target_humidity: friendly_name: Target humidity value_template: '{{ states.fan.xiaomi_air_humidifier.attributes.target_humidity }}' unit_of_measurement: '%' icon_template: mdi:water-percent input_number: airhumidifier_target_humidity: name: Target humidity min: 0 max: 99 step: 1 automation: - alias: Select target humidity by slider trigger: platform: state entity_id: input_number.airhumidifier_target_humidity action: - service: xiaomi_miio_airpurifier.fan_set_target_humidity data_template: entity_id: fan.xiaomi_air_humidifier humidity: '{{ states.input_number.airhumidifier_target_humidity.state|int }}' - alias: Monitor target humidity and update slider trigger: platform: state entity_id: sensor.airhumidifier_target_humidity action: service: input_number.set_value entity_id: input_number.airhumidifier_target_humidity data_template: value: '{{ states.fan.xiaomi_air_humidifier.attributes.target_humidity }}'
target_humidity
Атрибут подвергается в качестве датчика шаблона здесь. Так мы можем следить за состоянием датчика.
feedback appeared!
one addition!
name: Target humidity
min: 0
max: 99
step: 1
min must be greater than zero. otherwise, mode switching will not work correctly.
Perfect! Let's close this issue and open another one if there are further questions or suggestions.
Good 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
https://community.home-assistant.io/t/xiaomi-air-purifier-show-all-sensors-and-switches-in-ui-and-homekit/121786
unsuccessfully trying to add on / off lights, need your help.
here is my configuration.yaml file
here is an example of what I am trying to modify