Creating a power meter by counting pulses with LM393 and Tasmota

Hi all,
I've had a fun day trying to create a power meter, but ultimately I fear that I've gone about it the wrong way..... People MUST have done this before, but I've not managed to find them (the IotaWatt looks very cool, but overkill for me to start with).
I have a bunch of LM393 based modules to detect the pulses produced by my various meters (Electricity, Gas, Water, PV, car charger).

I've wired this up to a Wemos D1 Mini, and then flashed a custom compile of Tasmota for use with meters on to it - Smart Meter Interface - Tasmota
(I had hoped to use this to use serial to interrogate my meters, but there isn't enough guidance for my particular meters)
I've written a script to run within Tasmota:

->sensor53 r
>M 1
1,1-0:1.8.0*255(@1000,Solar Generation,kWh,Count,3

Full disclosure here - I do understand most of the script I've created here, but try as I might I can't understand this bit:


Which I copied from one of the examples.

All of this basically works - in the webUI I get sensible figures, well sort of:

Which now leaves me with a couple of issues to resolve:

  1. When I used Tasmota Device Manager to add it to HE, It created the parent and a "Universal Multi Sensor (child)" , but this does not show the current kWh figure - it shows no data at all - maybe this is too unique
  2. I need the kW as well as the kWh - it would seem most sensible to do this on the Wemos, and then send both to HE - I feel this might be possible in the Tasmota script, but I'm having difficulty following the guide

So clearly I'm out of my depth, though I feel like I'm quite close. All help gladly accepted - including pointers to a different Tasmota solution or a non-Tasmota solution (though I'd like to stick to the hardware - that seems good).



Ah - OK - so I understand problem 1 - I've started from the standard Tasmota code when I compiled my custom firmware - this is missing code used by the HE Tasmota setup here: [RELEASE] Tasmota for HE - Auto-detecting Tasmota drivers + Tasmota firmware 7.x/8.x for HE (for use with Tuya, Sonoff and other ESP devices)

I'll post there for guidance on that.....