Using ESP8266 and ESP Easy for energy/gas meters with S0 interface

I use an energy meter (Eltako WSZ15D-65A) to see, what my whirlpool consumes (spoiler: A LOT!) and my gas provider installed a “BK4” gas meter, which I’d like to read out also.

For that you’ll need:

  • Eltako WSZ15D-65A or any other energy meter with an S0 interface
  • elster IN-Z61 (or similar) for the gas meter, which basically is a reed contact
  • basically every other S0 counter will work
  • ESP8266 (I use a D1 Wemos)
  • bit of cables

How to put that stuff together I have explained here:

Now, the ESP sends the values to MQTT, so we just need to create MQTT-Things for each information, we like to have in openHAB and link it to a item:

You should have an MQTT-broker thing (called mqttbroker) already in openHAB (or just rename it in the code)

UID: mqtt:topic:mqttbroker:S0counter
label: MQTT S0 Counter
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:mqttbroker
channels:
  - id: GasCount
    channelTypeUID: mqtt:number
    label: Gas Pulses
    description: null
    configuration:
      stateTopic: openHAB/S0Counter/Gas/Count
  - id: GasTotal
    channelTypeUID: mqtt:number
    label: Gas Total
    description: null
    configuration:
      commandTopic: openHAB/S0Counter/Gas/Total
      retained: true
  - id: GasTime
    channelTypeUID: mqtt:number
    label: Gas Time
    description: null
    configuration:
      commandTopic: openHAB/S0Counter/Gas/Time
      retained: true
  - id: GasWatts
    channelTypeUID: mqtt:number
    label: Gas Watts
    description: null
    configuration:
      commandTopic: openHAB/S0Counter/Gas/W
      retained: true
  - id: WhirlpoolCount
    channelTypeUID: mqtt:number
    label: WhirlpoolPulses
    description: null
    configuration:
      stateTopic: openHAB/S0Counter/Whirlpool/Count
  - id: WhirlpoolTotal
    channelTypeUID: mqtt:number
    label: WhirlpoolTotal
    description: null
    configuration:
      commandTopic: openHAB/S0Counter/Whirlpool/Total
      retained: true
  - id: WhirlpoolTime
    channelTypeUID: mqtt:number
    label: WhirlpoolTime
    description: null
    configuration:
      commandTopic: openHAB/S0Counter/Whirlpool/Time
      retained: true
  - id: WhirlpoolWatts
    channelTypeUID: mqtt:number
    label: Whirlpool Watts
    description: null
    configuration:
      commandTopic: openHAB/S0Counter/Whirlpool/W
      retained: true

Now just link the Channels to items and you’re good to go!

3 Likes