MySensors Pulse Power Meter and OpenHAB?

I have a few temp/humidity sensors up and running using MySensors and the gateway uses MQTT to OpenHAB.

I’m trying to setup a power meter that detects LED pulses on my meter and sends this info to OpenHAB. The issue I seem to be having is that the arduino sketch starts with sending a request to the gateway to which OpenHAB needs to respond with the current KwH reading or something like that…

Long story short I don’t think anyone has go this working yet, if you have then do let me know.
My next approach was to just get the sensor to send a message to OpenHAB every time there is a “pulse” and then I’ll do all the KwH and Watt calculations within OpenHAB but my arduino skills are pretty rubbish so not sure I can even get that done :slightly_smiling:

I switched to your original topic (which I only noticed now) to not spam the other.

I have my powermeter on a node with 3 other child-sensors, so I thought it might be better to add my modifications to the example sketch. The sketch complies and I think it should work. However, I didn’t test it because for that I would have to disassemble the node in my fuse box. I uploaded the modified sketch to Github.

My item configuration:

Number ENERGY_Watt {mqtt="<[mysensor:MyMQTT/2/3/V_WATT:state:default]"} Number ENERGY_KWH {mqtt="<[mysensor:MyMQTT/2/3/V_KWH:state:default]"} Number ENERGY_PULSES {mqtt="<[mysensor:MyMQTT/2/3/V_VAR1:state:default]" } Number ENERGY_PULSES_post {mqtt=">[mysensor:MyMQTT/2/3/V_VAR1:state:*:default]"} Switch ENERGY_Req_Puls_Count {mqtt="<[mysensor:MyMQTT/2/3/V_VAR2:command:ON:1]"}

My rule:

rule "Power meter requests num of pulses" when Item ENERGY_Req_Puls_Count received command ON then if (ENERGY_PULSES.state > 0 ) { postUpdate(ENERGY_PULSES_post,ENERGY_PULSES.state) } else { postUpdate(ENERGY_PULSES_post,1) } end

My rrd4j configuration:

ENERGY_PULSES : strategy = everyChange, restoreOnStartup

Thanks so much @27maximilian, I’ll give this a chance as soon as I get some free time for sure!

You’re welcome. Good luck!

I am curious to hear if it worked out for you.