Add support for the single phase Shelly Pro EM as an output device
Summary
Adds a new output device type ShellyProEM which emulates the single phase Shelly Pro EM-50 (SPEM-002CEBEU50).
In contrast to the three phase Shelly Pro 3EM, the Pro EM provides two single phase meter channels (EM1/EM1Data components) instead of the three phase EM/EMData component. The emulation reports the summed up power and energy data of all input phases on channel 0, while channel 1 is reported as unused. This helps consumers which only support single phase Shelly devices or which misinterpret the three phase data of the Pro 3EM as described in #382 (Indevolt PowerFlex 2000 Eco treating solar production data of the three phases as consumption).
Closes #382
Implementation
- New output device
ShellyProEM(config blockuni-meter.output-devices.shelly-proem) which extends the existingShellyPro3EMactor and overrides the device identity and the meter components:Shelly.GetDeviceInforeportsmodel: SPEM-002CEBEU50,app: ProEM50,gen: 2, hostnameShellyProEM50-<MAC>and noprofilefield, matching a real Pro EM-50Shelly.GetStatus,Shelly.GetConfigandShelly.GetComponentsexposeem1:0,em1:1,em1data:0andem1data:1instead ofem:0/emdata:0NotifyStatuson the outbound websocket connection carries anem1:0payload
- New
EM1.GetStatus/GetConfigandEM1Data.GetStatus/GetConfigRPC methods, available via HTTP GET, JSON RPC over HTTP POST, websocket and UDP. TheEM1HTTP GET routes are only registered for the Pro EM device, the Pro 3EM behaves exactly as before - The
min-sample-periodthrottling of the websocket/UDP status polling now also applies toEM1.GetStatusrequests - New
device.hostname-prefixconfiguration value (defaults toShellyPro3EM-/ShellyProEM50-per device) used to build the default hostname from the mac address - Documentation (
doc/output/ShellyProEM.md), README and CHANGELOG updated
Testing
mvn testpasses- Manual smoke test with a
generic-httpinput feeding 423.5 W / mono phase:GET /rpc/EM1.GetStatus?id=0→{"id":0,"current":1.83,"voltage":230.00,"act_power":423.51,"aprt_power":423.51,"pf":1.00,"freq":50.00,"calibration":"factory"}EM1.GetStatus/EM1Data.GetStatusverified via HTTP GET, JSON RPC over HTTP POST and JSON RPC over UDP (udp-port), including the unused channel1and proper error responses for invalid channel idsShelly.GetDeviceInfo,/shelly,/settings,Shelly.GetStatus,Shelly.GetConfig,Shelly.GetComponentsverified to return the Pro EM component layout
- Regression test with the
shelly-pro3emoutput: unchanged behavior,EM1.*endpoints correctly return 404 there
This change was developed together with Claude (Anthropic's AI coding assistant): implementation, smoke testing and regression testing were done in a Claude Code session. Session: https://claude.ai/code/session_01N3pBKn7wJwAwW8uTWSLJWM