spacemanspiff2007 / sml2mqtt

Sml to MQTT Bridge
GNU General Public License v3.0
25 stars 8 forks source link

config get only partly recognized #22

Closed drmaex closed 1 year ago

drmaex commented 1 year ago

Hello and thank you for the project, everything works almost as expected but stable :) My problem is, that the configuration file i am providing only gets party recognized. Sorry i cant figure out how to create nice code view block....

I am observing the strange behavior that the config gets syntactically accepted, my mqtt main prefix is also working but the SmlListEntry's hex ID get the COM port prefixed instead of my configured subtopic

here is my configuration

logging:
  level: INFO         # Log level
  file: sml2mqtt.log  # Log file path (absolute or relative to config file)
mqtt:
  connection:
    client id: sml2mqtt
    host: mymqtthost
    port: myport
    user: 'myuser'
    password: 'mypass'
    tls: false
    tls insecure: false
  topic prefix: /max
  defaults:
    qos: 0         # Default value for QOS if no other QOS value in the config entry is set
    retain: false  # Default value for retain if no other retain value in the config entry is set
  last will:
    topic: status
general:
  Wh in kWh: true       # Automatically convert Wh to kWh
  republish after: 120  # Republish automatically after this time (if no other filter configured)
ports:
- url: /dev/ttyUSB0   # Device path
  timeout: 3        # Seconds after which a timeout will be detected (default=3)
devices:   # Device configuration by ID or url
  0a0149545200034bfc38:
    mqtt:
      topic: strom
    skip:    # OBIS codes (HEX) of values that will not be published (optional)
    - 0100600100ff
    values:  # Special configurations for each of the values (optional)
      0100100700ff:
        mqtt:             # Mqtt config for this entry (optional)
         topic: 0100100700ff
        filters:          # Refresh options for the value (optional)
        - perc: 15
      0100010800ff:
        mqtt:
         topic: 0100010800ff
        filters:
        - every: 120

and here is part of the output of the analysis run

[2023-02-05 14:12:23,195] [sml.ttyUSB0            ] INFO     | <SmlMessage>
[2023-02-05 14:12:23,195] [sml.ttyUSB0            ] INFO     |   transaction_id: 1c4d6303002bd02f
[2023-02-05 14:12:23,196] [sml.ttyUSB0            ] INFO     |   group_no      : 0
[2023-02-05 14:12:23,196] [sml.ttyUSB0            ] INFO     |   abort_on_error: 0
[2023-02-05 14:12:23,196] [sml.ttyUSB0            ] INFO     |   message_body <SmlOpenResponse>
[2023-02-05 14:12:23,196] [sml.ttyUSB0            ] INFO     |     codepage   : None
[2023-02-05 14:12:23,197] [sml.ttyUSB0            ] INFO     |     client_id  : None
[2023-02-05 14:12:23,197] [sml.ttyUSB0            ] INFO     |     req_file_id: 000000000371e7d6
[2023-02-05 14:12:23,197] [sml.ttyUSB0            ] INFO     |     server_id  : 0a0149545200034bfc38
[2023-02-05 14:12:23,197] [sml.ttyUSB0            ] INFO     |     ref_time   : 57796578
[2023-02-05 14:12:23,198] [sml.ttyUSB0            ] INFO     |     sml_version: None
[2023-02-05 14:12:23,198] [sml.ttyUSB0            ] INFO     |   crc16         : 55028
[2023-02-05 14:12:23,198] [sml.ttyUSB0            ] INFO     | <SmlMessage>
[2023-02-05 14:12:23,199] [sml.ttyUSB0            ] INFO     |   transaction_id: 1c4d6303002bd030
[2023-02-05 14:12:23,199] [sml.ttyUSB0            ] INFO     |   group_no      : 0
[2023-02-05 14:12:23,199] [sml.ttyUSB0            ] INFO     |   abort_on_error: 0
[2023-02-05 14:12:23,199] [sml.ttyUSB0            ] INFO     |   message_body <SmlGetListResponse>
[2023-02-05 14:12:23,200] [sml.ttyUSB0            ] INFO     |     client_id       : None
[2023-02-05 14:12:23,200] [sml.ttyUSB0            ] INFO     |     server_id       : 0a0149545200034bfc38
[2023-02-05 14:12:23,200] [sml.ttyUSB0            ] INFO     |     list_name       : 0100620affff
[2023-02-05 14:12:23,200] [sml.ttyUSB0            ] INFO     |     act_sensor_time : 57796578
[2023-02-05 14:12:23,201] [sml.ttyUSB0            ] INFO     |     val_list:
[2023-02-05 14:12:23,201] [sml.ttyUSB0            ] INFO     |       <SmlListEntry>
[2023-02-05 14:12:23,201] [sml.ttyUSB0            ] INFO     |         obis           : 010060320101 (1-0:96.50.1*1)
[2023-02-05 14:12:23,201] [sml.ttyUSB0            ] INFO     |         status         : None
[2023-02-05 14:12:23,201] [sml.ttyUSB0            ] INFO     |         val_time       : None
[2023-02-05 14:12:23,202] [sml.ttyUSB0            ] INFO     |         unit           : None
[2023-02-05 14:12:23,202] [sml.ttyUSB0            ] INFO     |         scaler         : None
[2023-02-05 14:12:23,202] [sml.ttyUSB0            ] INFO     |         value          : ITR
[2023-02-05 14:12:23,202] [sml.ttyUSB0            ] INFO     |         value_signature: None
[2023-02-05 14:12:23,203] [sml.ttyUSB0            ] INFO     |       <SmlListEntry>
[2023-02-05 14:12:23,203] [sml.ttyUSB0            ] INFO     |         obis           : 0100600100ff (1-0:96.1.0*255)
[2023-02-05 14:12:23,203] [sml.ttyUSB0            ] INFO     |         status         : None
[2023-02-05 14:12:23,203] [sml.ttyUSB0            ] INFO     |         val_time       : None
[2023-02-05 14:12:23,203] [sml.ttyUSB0            ] INFO     |         unit           : None
[2023-02-05 14:12:23,204] [sml.ttyUSB0            ] INFO     |         scaler         : None
[2023-02-05 14:12:23,204] [sml.ttyUSB0            ] INFO     |         value          : 0a0149545200034bfc38
[2023-02-05 14:12:23,204] [sml.ttyUSB0            ] INFO     |         value_signature: None
[2023-02-05 14:12:23,204] [sml.ttyUSB0            ] INFO     |       <SmlListEntry>
[2023-02-05 14:12:23,205] [sml.ttyUSB0            ] INFO     |         obis           : 0100010800ff (1-0:1.8.0*255)
[2023-02-05 14:12:23,205] [sml.ttyUSB0            ] INFO     |         status         : 1835268
[2023-02-05 14:12:23,205] [sml.ttyUSB0            ] INFO     |         val_time       : None
[2023-02-05 14:12:23,205] [sml.ttyUSB0            ] INFO     |         unit           : 30
[2023-02-05 14:12:23,206] [sml.ttyUSB0            ] INFO     |         scaler         : -1
[2023-02-05 14:12:23,206] [sml.ttyUSB0            ] INFO     |         value          : 32410582
[2023-02-05 14:12:23,206] [sml.ttyUSB0            ] INFO     |         value_signature: None
[2023-02-05 14:12:23,206] [sml.ttyUSB0            ] INFO     |         -> 3241058.2Wh (Zählerstand Total)
[2023-02-05 14:12:23,206] [sml.ttyUSB0            ] INFO     |       <SmlListEntry>
[2023-02-05 14:12:23,207] [sml.ttyUSB0            ] INFO     |         obis           : 0100100700ff (1-0:16.7.0*255)
[2023-02-05 14:12:23,207] [sml.ttyUSB0            ] INFO     |         status         : None
[2023-02-05 14:12:23,207] [sml.ttyUSB0            ] INFO     |         val_time       : None
[2023-02-05 14:12:23,207] [sml.ttyUSB0            ] INFO     |         unit           : 27
[2023-02-05 14:12:23,208] [sml.ttyUSB0            ] INFO     |         scaler         : 0
[2023-02-05 14:12:23,208] [sml.ttyUSB0            ] INFO     |         value          : 278
[2023-02-05 14:12:23,208] [sml.ttyUSB0            ] INFO     |         value_signature: None
[2023-02-05 14:12:23,208] [sml.ttyUSB0            ] INFO     |         -> 278W (aktuelle Wirkleistung)
[2023-02-05 14:12:23,208] [sml.ttyUSB0            ] INFO     |     list_signature  : None
[2023-02-05 14:12:23,209] [sml.ttyUSB0            ] INFO     |     act_gateway_time: None
[2023-02-05 14:12:23,209] [sml.ttyUSB0            ] INFO     |   crc16         : 19136
[2023-02-05 14:12:23,209] [sml.ttyUSB0            ] INFO     | <SmlMessage>

did I make a mistake in the configuraton? i would expect my mqtt topic to be /max/strom/0100100700ff and so on without the COM port

Thank you

spacemanspiff2007 commented 1 year ago

Try adding 'device id obis' under 'general'. Like this:

general:
  device id obis: '0100600100ff'
drmaex commented 1 year ago

thank you for the fast response. now it works and I get expected mqtt topics.