Klipper macro for reading energy meter "Shelly Pro 1PM

I’m not a “Klipper macro” guru at all. I installed a “Shelly Pro 1PM” on my “Voron 2.4.” Everything works fine, as I intended, except for the energy meter part. I installed and configured the MQTT broker, and it works. Now I’d like to create a macro in Klipper that reads the data from the energy meter (Shelly Pro 1PM). I want to make this data visible in the Klipper console. I’ve been looking for an example for days. The only thing I’ve found is the configuration in Moonraker, but no macro. I think it might be very simple, but, for the moment, as I said, I am not a “Klipper macro” guru at all. :roll_eyes:

# moonraker.conf

[sensor mqtt_powermeter]
type: mqtt
name: Power meter
parameter_power:
  units=W
parameter_voltage:
  units=V
parameter_current:
  units=mA
parameter_energy:
  units=kWh
state_topic: shellypro1pm-8813bfda8058.local/status/switch:0
state_response_template:
{% set notification = payload|fromjson %}
{set_result("power", notification["apower"]|float)}
{set_result("voltage", notification["voltage"]|float)}
{set_result("current", notification["current"]|float)}
{set_result("energy", notification["aenergy"]["by_minute"][0]|float * 0.000001)}

Can someone help me create a macro for this in Klipper?
Is there some kind of tutorial about communication between “Klipper MQTT Moonraker” ?

Thanks in advance :slightly_smiling_face:

Marc

This is not possible.
What is Klipper supposed to do with these values? Klipper is a printer firmware and not really interested in its current energy consumption.

You can have Moonraker track historic data for such sensors. See Configuration - Moonraker
In Mainsail you can display them. See Additional Sensors | Mainsail