Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help Wanted] 实体的状态不可靠 #6

Open
Vizards opened this issue Dec 25, 2020 · 0 comments
Open

[Help Wanted] 实体的状态不可靠 #6

Vizards opened this issue Dec 25, 2020 · 0 comments

Comments

@Vizards
Copy link

Vizards commented Dec 25, 2020

我在尝试使用 xiaomi_airconditioningcompanionMCN02 构建一个类型为 Generic Thermostat 的 climate 实体。发现在调用 turn_on 或者 turn_off 之后,climate.xiaomi_air_conditioning_companion_2.hvac_mode 不能被检测到立即改变,所以就会出现调用 turn_on 后无法调用 turn_off

configuration.yaml 如下:

- platform: xiaomi_miio_airconditioningcompanion #小米空调伴侣2
  name: xiaomi Air Conditioning Companion 2
  host: IP
  token: TOKEN
  target_sensor: sensor.temperature_158d0001f53706
  scan_interval: 60
- platform: generic_thermostat #通用恒温器,真实空调实体
  name: Bedroom Air Conditioner
  heater: switch.bedroom_ac
  target_sensor: sensor.climate_bedroom_ac
  min_temp: 16
  max_temp: 31
  precision: 1
         
switch:
  - platform: template #通用恒温器所需模板开关
    switches:
      bedroom_ac:
        friendly_name: 卧室空调
        value_template: "{{ not is_state('climate.xiaomi_air_conditioning_companion_2.hvac_mode', 'off') }}"
        turn_on:
          - service: climate.turn_on
            data:
              entity_id: climate.xiaomi_air_conditioning_companion_2
        turn_off:
          - service: climate.turn_off
            data:
              entity_id: climate.xiaomi_air_conditioning_companion_2

所以想咨询下有无可靠的方案去检测当前空调的状态,让 switch 实体可以将它作为 value_template 使用?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant