Home Assistant 2021.8.x 能源 個別裝置監控範例

有朋友在問,他想要把米家空調伴侶加入能源監控。由於,空調伴侶透過 syssi 的 plug-in 接入 HA 後,只有 load_power 這個屬性。
HA 需要的是 energy sensor,因此,需要轉換一下。下面是相關的 yaml

sensor:
  - platform: integration
    source: sensor.main_bedroom_climate_load_power
    name: MainBedroom Climate Total Power Consumption
    unit_prefix: k
    round: 3

template:
  - sensor:
    - name: "Main BedRoom Climate Load Power"
      unit_of_measurement: "W"
      state: >
        {{ state_attr('climate.main_bedroom_acpartner', 'load_power') }}
      state_class: measurement
      device_class: power

customize: 
  sensor.mainbedroom_climate_total_power_consumption:
    device_class: energy

沒問題的話,就會有二個實體 Sensors

image

第二個實體就可以加入監控
image

6個讚

是指要用新的Lovelace能源面板去監控的話,需要按官方規定滿足他對energy sensor的要求嗎?

是的
如果這邊所寫

補充一點:
要加入 HA 能源監控的實體, 必須要在 recorder 記錄

2-3圖消失了!

1個讚

YAML檢查時出現

設定無效!

Invalid config for [sensor.integration]: The ‘unit’ option has been removed, please remove it from your configuration. Got OrderedDict([(‘platform’, ‘integration’), (‘source’, ‘sensor.main_bedroom_climate_load_power’), (‘name’, ‘MainBedroom Climate Total Power Consumption’), (‘unit_prefix’, ‘k’), (‘unit’, ‘kWh’), (‘round’, 3)]). (See ?, line ?).

新的 HA core 把 unit 拿掉了

1個讚