jaroschek / home-assistant-myuplink

Custom Home Assistant integration for devices and sensors in myUplink account.
39 stars 8 forks source link

Fix invalid response #35

Closed jaroschek closed 8 months ago

jaroschek commented 8 months ago

As reported in #10 the request to Home Assistant API config/entity_registry/list ends in an error as soon as the myUplink integration is configured.

Through debugging in the browser interface the following details have been found:

ZodError: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      201,
      "translation_key"
    ],
    "message": "Expected string, received number"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      218,
      "translation_key"
    ],
    "message": "Expected string, received number"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      232,
      "translation_key"
    ],
    "message": "Expected string, received number"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      233,
      "translation_key"
    ],
    "message": "Expected string, received number"
  }
]
    at get error [as error] (http://localhost:8123/hacsfiles/frigate-hass-card/card-555679fd.js:75:37985)
    at Object.invokeGetter (<anonymous>:3:28)
    at cp (http://localhost:8123/hacsfiles/frigate-hass-card/card-555679fd.js:75:138544)
    at async nb.fetchEntityList (http://localhost:8123/hacsfiles/frigate-hass-card/card-555679fd.js:507:2764)
    at async _v.initializeCameras (http://localhost:8123/hacsfiles/frigate-hass-card/card-555679fd.js:75:178964)
    at async kb._initializeCameras (http://localhost:8123/hacsfiles/frigate-hass-card/card-555679fd.js:507:25437)
    at async http://localhost:8123/hacsfiles/frigate-hass-card/card-555679fd.js:507:26917
    at async sb.initializeIfNecessary (http://localhost:8123/hacsfiles/frigate-hass-card/card-555679fd.js:507:7148)

As described, there are entities that deliver an Number value as translation_key but this hast to be a String.

This merge request will fix this.