ualex73 / docker-s0pcm-reader

S0PCM-Reader
Apache License 2.0
4 stars 2 forks source link

No MQTT reports being send? #8

Closed prolife86 closed 1 year ago

prolife86 commented 1 year ago

Hi!

I have created this docker on a Raspberry Pi, and it seems I have not setup something correctly. The S0PCM-5 is connected to solar pannels with 1000Imp/KwH (Algodue UEM80-4D R pulse meter) There was one error reported, as I had no measurements.yaml, that was fixed automatically and now I can see in the measurements it is counting up, it was 0, now 22 (bad day of sun, running for half an hour)

date: 2023-04-24 1: pulsecount: 22 today: 22 total: 15000701 yesterday: 0

The total is derrived from the current meter readout: 15000,69 (times 1000 impulses = 15000690)

I can see it registering in the Mosquitto 2.0.15, running unsecured : 1682323131: New client connected from 192.168.1.154:53265 as S0PCM (p2, c1, k60). (This is on an Unraid cmccambridge/mosquitto-unraid Latest docker container) But no data appears to be published. I can only see the client reporting in on Mosquitto, no messages. Mossquitto is connected to Home Assistant, but also there no device is visible as S0PCM (Or any other new ones)

configuration.yaml.txt measurement.yaml.txt s0pcm-reader.log.txt

Did I set it up wrongly? Did I miss something?

prolife86 commented 1 year ago

Well, this is bad.... I did not subscribe to the topics in HA, so not visible When I scanned with # as topic I fount them. And was able to solve it:

The template in HA was this, I hope someone might find it usefull:

"configuration.yaml" contains:

mqtt:
  sensor: !include_dir_merge_list sensors/mqtt
sensor:
  - platform: derivative
    source: sensor.solar_production_today
    name: 'Solar Production S0 (W)'
    unit: W
    unit_time: h

  - platform: derivative
    source: sensor.car_charger_today
    name: 'Car Charger S0 (W)'
    unit: W
    unit_time: h

"sensors/mqtt" contains a file "sensors_S0PCM_mqtt.yaml" which contains:

    - name: "Solar Production Total"
      state_topic: "s0pcmreader/1/total"
      unique_id: "Production_Total"
      value_template: "{{ value_json | float / 1000 }}"
      unit_of_measurement: kWh
      icon: mdi:SolarPowerVariantOutline
      device_class: energy
      state_class: total
    - name: "Solar Production Today"
      state_topic: "s0pcmreader/1/today"
      unique_id: "Production_Today"
      value_template: "{{ value_json | float / 100 }}"
      unit_of_measurement: Wh
      icon: mdi:SolarPowerVariantOutline
    - name: "Solar Production Yesterday"
      state_topic: "s0pcmreader/1/yesterday"
      unique_id: "Production_Yesterday"
      value_template: "{{ value_json | float / 100 }}"
      unit_of_measurement: Wh
      icon: mdi:SolarPowerVariantOutline
    - name: "Car Charger Total"
      state_topic: "s0pcmreader/2/total"
      unique_id: "Car_Charge_Total"
      value_template: "{{ value_json | float / 1000 }}"
      unit_of_measurement: kWh
      icon: mdi:EvStation
      device_class: energy
      state_class: total
    - name: "Car Charger Today"
      state_topic: "s0pcmreader/2/today"
      unique_id: "Car_Charge_Today"
      value_template: "{{ value_json | float / 100 }}"
      unit_of_measurement: Wh
      icon: mdi:EvStation
    - name: "Car Charger Yesterday"
      state_topic: "s0pcmreader/2/yesterday"
      unique_id: "Car_Charge_Yesterday"
      value_template: "{{ value_json | float / 100 }}"
      unit_of_measurement: Wh
      icon: mdi:EvStation