khenderick / esphome-opentherm

OpenTherm support for ESPHome
MIT License
14 stars 4 forks source link

How to add custom entities (available OT MSG)? #4

Closed 5A52 closed 1 year ago

5A52 commented 1 year ago

Is there an easy way to add entities? For example I can read MSG_DHW_FLOW_RATE from my boiler, but no MSG_CH_PRESSURE or MSG_TRET (just removed them from yaml). . upd> I can see continous

[10:35:22][W][opentherm:206]: Received invalid response: UNKNOWN_DATA_ID(28, 0x0000)
[10:35:23][W][opentherm:206]: Received invalid response: UNKNOWN_DATA_ID(18, 0x0000)

in the log. Removing\commenting in yaml is not enoght, absent entities must be disabled deeper

khenderick commented 1 year ago

I've update the code to only request data for configured sensors. You should not see the UNKNOWN_DATA_ID messages anymore if those sensors are not configured.

Next up, I'll implement the DHW flow rate.

khenderick commented 1 year ago

I've added support for DHW flow rate. Can you update your config to:

...

external_components:
  source: github://khenderick/esphome-opentherm@feature/dhw_flow_rate
  components: [opentherm]
  refresh: 0s

...

sensor:
  - platform: opentherm
    ...
    dhw_flow_rate:
      name: "DHW flow rate"
    ...

...

And let me know if it's working as expected?

5A52 commented 1 year ago

I can confirm, "DHW flow rate" works as expected and there is no UNKNOWN_DATA_ID in the log. Thankns! Can you please also add DHW_TEMP = 26,?

khenderick commented 1 year ago

I've added it to the same branch.

...

sensor:
  - platform: opentherm
    ...
    dhw_temperature:
      name: "DHW temperature"
    ...

...

Can you let me know if it's working?

5A52 commented 1 year ago

Thank you, works as expected!

khenderick commented 1 year ago

You're welcome. The code is merged to main, so you can omit the branch name in the components section.

5A52 commented 1 year ago

Not sure if it is good to correct this in esphome-opentherm, as logically "l/min" and "measurement" are correct for water, but I have this two errors:

Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:650
Integration: Sensor (documentation, issues)
First occurred: 17:26:48 (2 occurrences)
Last logged: 17:26:49

Entity sensor.wbn6000_dhw_flow_rate (<class 'homeassistant.components.esphome.sensor.EsphomeSensor'>) is using native unit of measurement 'L/min' which is not a valid unit for the device class ('water') it is using; expected one of ['gal', 'm³', 'ft³', 'L', 'CCF']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+esphome%22
Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:496
Integration: Sensor (documentation, issues)
First occurred: 17:26:48 (1 occurrences)
Last logged: 17:26:48

Entity sensor.wbn6000_dhw_flow_rate (<class 'homeassistant.components.esphome.sensor.EsphomeSensor'>) is using state class 'measurement' which is impossible considering device class ('water') it is using; expected None or one of 'total', 'total_increasing'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+esphome%22
khenderick commented 1 year ago

I'll indeed have to fix this. I'll see whether there's a better device_class/unit combination.

khenderick commented 1 year ago

Unfortunately there isn't a device class in Home Assistant that matches "flow of water", so I've removed the device class;

...
external_components:
  source: github://khenderick/esphome-opentherm@fix/remove_device_class
  components: [opentherm]
  refresh: 0s
...

Can you give this a try?

5A52 commented 1 year ago

Sure, no errors. Thanks