Fabian-Schmidt / esphome-truma_inetbox

ESPHome component to remote control Truma CP Plus Heater
GNU General Public License v3.0
39 stars 8 forks source link

FR: Electricity connected binary sensor #40

Open savikko opened 3 months ago

savikko commented 3 months ago

It seems that there is not currently binary sensor to see if outside electricity/supply 230VAC is connected.

Although, it seems that OPERATING_STATUS changes from 5 to 7 when electricity is connected but it also seems that this status has other functionalities so this cannot be used as a binary sensor here.

So, this sensor would be only to get info that is there outside electricity connected.

Will update this issue to provide the source for this info (I have found this somewhere, but needs little bit searching).

savikko commented 3 months ago

Ah, operating status is actually binary, so quicky hack to get that data is to parse bits from that value like this:

binary_sensor:
  - platform: template
    name: "Supply Electricity"
    lambda: |-
      return ((int) id(operating_status).state & 0b00000010) != 0;

sensor:
  - platform: truma_inetbox
    name: "Operating status"
    id: operating_status
    type: OPERATING_STATUS
7wells commented 3 days ago

@savikko Could you please provide more guidance how this is used? Is this code to be placed in configuration.yaml or in the code of the ESP32/smartavan device? I have your device with Fabian's coffee but do not understand how to proceed. Thanks for your help!