easimon / shelly-exporter

Prometheus exporter for shelly devices
5 stars 1 forks source link

Failed to register Shelly Pro3EM (rpc/Shelly.GetDeviceInfo) #115

Closed lmrts closed 3 months ago

lmrts commented 3 months ago

Hi, I'm having issues registering a Shelly Pro3EM with this exporter (might be related to issue #81).

It fails to execute the rpc/Shelly.GetDeviceInfo request, with error:

HTTP Request failure: Error while extracting response for type [class click.dobel.shelly.exporter.client.api.gen2.Gen2ShellyDeviceInfo] and content type [application/json]

According to the docs [1], the expected response should be:

{
  "id":"shellydev1-f008d1e2cb4c",
  "mac":"F008D1E2CB4C",
  "model":"SNSW-devX16EU",
  "gen":2,
  "fw_id":"20210908-124312/0.7.0-29-g0df1661-145-rpc-http-get-improvements-2",
  "ver":"0.7.0",
  "app":"Dev1",
  "auth_en":false,
  "auth_domain":null
}

but the Pro3EM returns:

{
  "name": "shellydev1",
  "id": "shellypro3em-f008d1e2cb4c",
  "mac": "F008D1E2CB4C",
  "slot": 1,
  "model": "SPEM-003CEBEU",
  "gen": 2,
  "fw_id": "20240726-114514/1.4.0-gb2aeadb",
  "ver": "1.4.0",
  "app": "Pro3EM",
  "auth_en": false,
  "auth_domain": null,
  "profile": "triphase"
}

Is it possible to implement support for this device?

[1] https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/HTTP/#httpget-example

easimon commented 3 months ago

The device itself is supported -- It seems you do not have authentication enabled, and this is currently not working, because the "auth_domain" field is expected to be non-null.

I have authentication enabled (I set a password on the Shelly), so i never ran into this issue.

116 should fix this... i'll create a new release as soon as the build succeeds

easimon commented 3 months ago

I did not mean to close it -- Github did so automatically. Please check if 2.5.9 fixes it for you. If it does, please confirm here and close the issue.

lmrts commented 3 months ago

The device itself is supported -- It seems you do not have authentication enabled, and this is currently not working, because the "auth_domain" field is expected to be non-null.

Ah, missed that. I confirm it's working with v2.5.9, thanks! And thanks for this great project 👍

Logs:

2024-08-05T12:24:49.700+01:00  INFO 1 --- [   scheduling-1] c.d.s.e.d.ShellyGen2DeviceRegistry       : Updating device addresses.
2024-08-05T12:24:49.965+01:00  INFO 1 --- [   scheduling-1] c.d.s.e.d.ShellyGen2DeviceRegistry       : Added 1, removed 0, current amount: 1 devices.
2024-08-05T12:24:49.968+01:00  INFO 1 --- [   scheduling-1] c.d.s.e.metrics.ShellyGen2Metrics        : Registering ShellyDevice(mac=F008D1E2CB4C, address=x.x.x.x, name=shellydev1-f008d1e2cb4c, type=SPEM-003CEBEU, firmwareVersion=20240726-114514/1.4.0-gb2aeadb).
2024-08-05T12:27:57.824+01:00  INFO 1 --- [  XNIO-1 task-2] io.undertow.servlet                      : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-08-05T12:27:57.824+01:00  INFO 1 --- [  XNIO-1 task-2] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2024-08-05T12:27:57.825+01:00  INFO 1 --- [  XNIO-1 task-2] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms