alengwenus / esphome_components

External components for ESPHome
GNU General Public License v3.0
29 stars 9 forks source link

ZPA ZE312 and different obis formatf #10

Closed evlo closed 1 year ago

evlo commented 1 year ago

This issue, well request, is actually about default esphome component esphome/components/sml

My meter says it does conform to IEC62056-21 but it does not have the formatting formatting as meter in germany do image

Even when changing the validation in init.py i do not get component to react to incoming messages

This is how I trigger meter to communicate

uart:
  id: uart_bus
  tx_pin: GPIO21
  rx_pin: GPIO20  
  baud_rate: 300
  data_bits: 7
  stop_bits: 1
  parity: EVEN
  debug: 
    direction: BOTH
    dummy_receiver: false
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

interval:
  - interval: 61sec
    then:
      - uart.write:
          id: uart_bus
          data: [0x2F, 0x3F, 0x21, 0x0D, 0x0A]

This is basically sml config the I would like to be able to use

sml:
  id: zpasml
  uart_id: uart_bus

sensor:
  - platform: sml
    name: "L1"
    sml_id: zpasml
    obis_code: "21.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 3
    device_class: energy
    state_class: total_increasing

Most likely what my meter spits out is not actually SML, but called IEC62056-21 or sometimes d0 - i think it goes like d0 is the port, IEC62056-21 is the definition of the IR communication, SML is the "extended" protocol and OBIS codes are what each code mean, so even though my meter uses IEC62056-21, d0 and OBIS it is most likely not SML, but just IEC62056-21 compliant (which contains basic protocol, but not exactly SML - sml seems to me that it might be IEC62056-21 for multiple meters on the same bus).

So what I would really need to do is whole new component for IEC62056-21

unfortunately this my first encounter with CPP so I was wonder if you, @alengwenus as an code author, might find some time to try to modify version so it can parse messages without the leading 1-0:m so 1-0:1.8.0 is what esphome sml component excepts as obis, but 1.8.0 is what my meter sends - also unsure about rest of the format, but seems same