the78mole / esphome_components

ESPhome Components from the little digger
Other
24 stars 11 forks source link

Feature request - add some missing sensors #26

Closed qschneider closed 1 year ago

qschneider commented 1 year ago

The following sensor are missing so far - but would be nice to have ;-) I describe them as detailed as i can, but there are missing steps to calculate or concatenate these values.

Brennerlaufzeit Enthält zusammen mit den beiden folgenden Werten den Betriebszähler des Brenners auf Stufe 1. (Byte3 65536) + (Byte2 256) + Byte 1 = Laufzeit in Minuten Betriebsminuten Stufe 1 0x8836 - Byte3, 0x8837 - Byte2, 0x8838 - Byte1 Betriebsminuten Stufe 2 0x8839 - Byte3, 0x883A - Byte2, 0x883B - Byte1

BLZ1S2    = 0x8836, //: "Brennerlaufzeit 1 Stunden 2"
BLZ1S1    = 0x8837, //: "Brennerlaufzeit 1 Stunden 1"
BLZ1S0    = 0x8838, //: "Brennerlaufzeit 1 Stunden 0"
BLZ2S2    = 0x8839, //: "Brennerlaufzeit 2 Stunden 2"
BLZ2S1    = 0x883a, //: "Brennerlaufzeit 2 Stunden 1"
BLZ2S0    = 0x883b, //: "Brennerlaufzeit 2 Stunden 0"

Versionsnummer (Hauptversionsnummer, HV) Die Version der Logamatic-Firmware im Format "HV.NV" Versionsnummer 0x893E, 0x893F

VVK       = 0x893e, //: "Versionsnummer VK"
VNK       = 0x893f, //: "Versionsnummer NK"

MODKENN   = 0x8940, //: "Modulkennung"

sensor.py

 from esphome.const import (
  CONF_ID,
  UNIT_CELSIUS,
  UNIT_PERCENT,
  UNIT_MIN,
  DEVICE_CLASS_EMPTY,
  DEVICE_CLASS_DURATION,
  DEVICE_CLASS_TEMPERATURE,
  STATE_CLASS_MEASUREMENT,
  STATE_CLASS_TOTAL_INCREASING,
  ENTITY_CATEGORY_DIAGNOSTIC,
  ENTITY_CATEGORY_NONE
  )

TYPES = [
  ...
  "burner_operation_minutes_l1",
  "burner_operation_minutes_l2",
  "firmware_version",
  "module_id"
]

cv.Optional("burner_operation_minutes_l1"): sensor.sensor_schema(
    unit_of_measurement=UNIT_MIN,
    device_class=DEVICE_CLASS_DURATION,
    state_class=STATE_CLASS_TOTAL_INCREASING,
    entity_category=ENTITY_CATEGORY_NONE,   
),
cv.Optional("burner_operation_minutes_l2"): sensor.sensor_schema(
    unit_of_measurement=UNIT_MIN,
    device_class=DEVICE_CLASS_DURATION,
    state_class=STATE_CLASS_TOTAL_INCREASING,
    entity_category=ENTITY_CATEGORY_NONE,   
),
cv.Optional("firmware_version"): sensor.sensor_schema(
    device_class=DEVICE_CLASS_EMPTY,
    entity_category=ENTITY_CATEGORY_DIAGNOSTIC,     
),
cv.Optional("module_id"): sensor.sensor_schema(
    device_class=DEVICE_CLASS_EMPTY,
    entity_category=ENTITY_CATEGORY_DIAGNOSTIC,     
),

km271.h

GENERATE_SENSOR_SETTER(burner_operation_minutes_l1, ???); # (BLZ1S2 * 65536) + (BLZ1S1 * 256) + BLZ1S0
GENERATE_SENSOR_SETTER(burner_operation_minutes_l2, ???););  # (BLZ2S2 * 65536) + (BLZ2S1 * 256) + BLZ2S0
GENERATE_SENSOR_SETTER(firmware_version, ???); # VVK+"."+VNK
GENERATE_SENSOR_SETTER(module_id, MODKENN);

buderus-km271.yaml

burner_operation_minutes_l1:
  name: "Brennerlaufzeit Stufe1"
burner_operation_minutes_l2:
  name: "Brennerlaufzeit Stufe2"
firmware_version:
  name: "Logamatic Versionsnummer"
module_id:
  name: "Logamatic Modulkennung"
the78mole commented 1 year ago

Ja, das hätte ich tatsächlich auch gerne, allerdings müsste man die Laufzeiten im Brenner natürlich zusammenbauen und dafür muss man erst mal alle Teile haben. Und die kommen ja nur bei Änderungen. Wird ziemlich ekelig im C++-Code. Schaffe ich zeitlich gerade nicht.

qschneider commented 1 year ago

maybe an alternative would be to generate entities off BLZ1S2... but keep them internally in esphome to do the processing over there. Finally the public entity would be a template.

fi

# Brennerlaufzeit Enthält zusammen mit den beiden folgenden Werten den Betriebsstundenzähler des Brenners auf Stufe 1. (Byte3 * 65536) + (Byte2 * 256) + Byte 1 = Laufzeit in Minuten
burner_operation_minutes_l1s2:              #0x8836
  id:                                       BLZ1S2
  internal:                                 true  #internal (Optional, boolean): Mark this component as internal. Internal components will not be exposed to the frontend (like Home Assistant). Only specifying an id without a name will implicitly set this to true.
burner_operation_minutes_l1s1:              #0x8837
  id:                                       BLZ1S1
burner_operation_minutes_l1s0:              #0x8838
  id:                                       BLZ1S0
burner_operation_minutes_l2s2:              #0x8839
  id:                                       BLZ2S2
burner_operation_minutes_l2s1:              #0x883A
  id:                                       BLZ2S1
burner_operation_minutes_l2s0:              #0x883B
  id:                                       BLZ2S0
# Versionsnummer (Hauptversionsnummer, HV) Die Version der Logamatic-Firmware im Format "HV.NV"
firmware_version_vk:                        #0x893E
  id:                                       VVK
firmware_version_nk:                        #0x893F
  id:                                       VNK
module_id:                                  #0x8940
  name:                                     "Logamatic Modulkennung"

# - platform: template
#   burner_operation_minutes_l1:
#     name:                                     "Brennerlaufzeit Stufe1"
#     entity_category: diagnostic
#     lambda: |-
#     if (id(BLZ1S2).state) {
#       do some math...
#       return xyz;
#     }
jensgraef commented 1 year ago

I've added C++ code for the boiler runtime in #31. There are still open issues. @qschneider Would you mind testing whether you get a plausible value?

qschneider commented 1 year ago

Yes i can check this, wrote a comment in the pull request, maybe it helps.

qschneider commented 1 year ago

Any chance to add VVK.VNK and MODKENN in the future? These values are just to be more feature complete, they probably will never change. In my case they would be 3.18 and 6

jensgraef commented 1 year ago

Any chance to add VVK.VNK and MODKENN in the future? These values are just to be more feature complete, they probably will never change. In my case they would be 3.18 and 6

There's certainly a chance :)

jensgraef commented 1 year ago

Firmware version comes with #58

jensgraef commented 1 year ago

I'd suggest closing this issue as we now have everything except MODKENN. And MODKENN is not very helpful imho.