Closed
Description
The problem
The Shelly Pro 4PM can measure energy and power in both directions. However, only the total energy sensor is exposed in HA, which includes the returned energy - the energy calculated is thus wrong and jumps around. If the returned energy sensor was exposed, it would be easy to correctly calculate the consumed energy.
This is similar to #135394, but the "ret_aenergy" sub key needs to be added to the key "switch".
What version of Home Assistant Core has the issue?
core-2025.5.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
shelly
Link to integration documentation on our website
https://www.home-assistant.io/integrations/shelly/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response