marvinroger / hass-addon-tiko

Control your tiko / Mon Pilotage Elec heaters from Home Assistant
10 stars 1 forks source link

Credentials Error since this morning (ZodError) #5

Closed dlevequeIT closed 6 months ago

dlevequeIT commented 7 months ago

I setup my new Home Assistant Yellow Core device monday and I successfully integrate this addon and my devices. All worked but this morning, I saw that I was unable to control my devices. All other IoT cloud devices works, Mosquito broker is up & running but Tiko addon crash after 2sd with this message in the logs:


[15:30:08.743] ERROR (7): Failed to fetch data from Tiko; are the credentials correct?
    err: {
      "type": "ZodError",
      "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"array\",\n    \"received\": \"null\",\n    \"path\": [\n      \"data\",\n      \"properties\"\n    ],\n    \"message\": \"Expected array, received null\"\n  }\n]",
      "stack":
          ZodError: [
            {
              "code": "invalid_type",
              "expected": "array",
              "received": "null",
              "path": [
                "data",
                "properties"
              ],
              "message": "Expected array, received null"
            }
          ]
              at get error [as error] (file:///app/node_modules/zod/lib/index.mjs:538:31)
              at doTikoRequest (file:///app/dist/tiko/client.js:147:31)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async TikoClient.fetchData (file:///app/dist/tiko/client.js:47:32)
              at async file:///app/dist/index.js:16:27
      "aggregateErrors": [
        {
          "type": "Object",
          "message": "Expected array, received null",
          "stack":

          "code": "invalid_type",
          "expected": "array",
          "received": "null",
          "path": [
            "data",
            "properties"
          ]
        }
      ],
      "issues": [
        {
          "code": "invalid_type",
          "expected": "array",
          "received": "null",
          "path": [
            "data",
            "properties"
          ],
          "message": "Expected array, received null"
        }
      ],
      "name": "ZodError"
    }

And, for sure, I already verified credentials are the right and authentication on https://portal-engie.tiko.ch/ is a success. Could you help me? There had an update of the API pushed?

andreidobrica commented 7 months ago

Hi

I have the same issues for two weeks now. It worked temporarily when I entered the Property Id.

On Wed, 21 Feb 2024, 15:37 dlevequeIT, @.***> wrote:

I setup my new Home Assistant Yellow Core device monday and I successfully integrate this addon and my devices. All worked but this morning, I saw that I was unable to control my devices. All other IoT cloud devices works, Mosquito broker is up & running but Tiko addon crash after 2sd with this message in the logs: `[15:30:08.743] ERROR (7): Failed to fetch data from Tiko; are the credentials correct? err: { "type": "ZodError", "message": "[\n {\n "code": "invalid_type",\n "expected": "array",\n "received": "null",\n "path": [\n "data",\n "properties"\n ],\n "message": "Expected array, received null"\n }\n]", "stack": ZodError: [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ] at get error [as error] (file:///app/node_modules/zod/lib/index.mjs:538:31) at doTikoRequest (file:///app/dist/tiko/client.js:147:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async TikoClient.fetchData (file:///app/dist/tiko/client.js:47:32) at async file:///app/dist/index.js:16:27 "aggregateErrors": [ { "type": "Object", "message": "Expected array, received null", "stack":

  "code": "invalid_type",
  "expected": "array",
  "received": "null",
  "path": [
    "data",
    "properties"
  ]
}

], "issues": [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ], "name": "ZodError" }`

And, for sure, I already verified credentials are the right and authentication on https://portal-engie.tiko.ch/ is a success. Could you help me? There had an update of the API pushed?

— Reply to this email directly, view it on GitHub https://github.com/marvinroger/hass-addon-tiko/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARH7OO7PQAOAOP3M4KXDU7TYUYBELAVCNFSM6AAAAABDTFRUFKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2DMOJRGU3DQOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

dlevequeIT commented 7 months ago

Hello. Thank you for your feedback. Could you tell me where find the Property Id?

Regards -------- Message d'origine -------- Le 21 févr. 2024, 17:39, asterixmic a écrit :

Hi

I have the same issues for two weeks now. It worked temporarily when I entered the Property Id.

On Wed, 21 Feb 2024, 15:37 dlevequeIT, @.***> wrote:

I setup my new Home Assistant Yellow Core device monday and I successfully integrate this addon and my devices. All worked but this morning, I saw that I was unable to control my devices. All other IoT cloud devices works, Mosquito broker is up & running but Tiko addon crash after 2sd with this message in the logs: `[15:30:08.743] ERROR (7): Failed to fetch data from Tiko; are the credentials correct? err: { "type": "ZodError", "message": "[\n {\n "code": "invalid_type",\n "expected": "array",\n "received": "null",\n "path": [\n "data",\n "properties"\n ],\n "message": "Expected array, received null"\n }\n]", "stack": ZodError: [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ] at get error [as error] (file:///app/node_modules/zod/lib/index.mjs:538:31) at doTikoRequest (file:///app/dist/tiko/client.js:147:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async TikoClient.fetchData (file:///app/dist/tiko/client.js:47:32) at async file:///app/dist/index.js:16:27 "aggregateErrors": [ { "type": "Object", "message": "Expected array, received null", "stack":

"code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ] } ], "issues": [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ], "name": "ZodError" }`

And, for sure, I already verified credentials are the right and authentication on https://portal-engie.tiko.ch/ is a success. Could you help me? There had an update of the API pushed?

— Reply to this email directly, view it on GitHub https://github.com/marvinroger/hass-addon-tiko/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARH7OO7PQAOAOP3M4KXDU7TYUYBELAVCNFSM6AAAAABDTFRUFKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2DMOJRGU3DQOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

andreidobrica commented 7 months ago

Hi,

You can find it in the Tiko URL when you use the web application, after the/dashboard/ , for example https://particuliers-tiko.fr/dashboard/xxxxxxxx

But for me this workaround was ok only for few days. I am curious if it is more permanent for you.

Regards

On Wed, 21 Feb 2024, 23:03 dlevequeIT, @.***> wrote:

Hello. Thank you for your feedback. Could you tell me where find the Property Id?

Regards -------- Message d'origine -------- Le 21 févr. 2024, 17:39, asterixmic a écrit :

Hi

I have the same issues for two weeks now. It worked temporarily when I entered the Property Id.

On Wed, 21 Feb 2024, 15:37 dlevequeIT, @.***> wrote:

I setup my new Home Assistant Yellow Core device monday and I successfully integrate this addon and my devices. All worked but this morning, I saw that I was unable to control my devices. All other IoT cloud devices works, Mosquito broker is up & running but Tiko addon crash after 2sd with this message in the logs: `[15:30:08.743] ERROR (7): Failed to fetch data from Tiko; are the credentials correct? err: { "type": "ZodError", "message": "[\n {\n "code": "invalid_type",\n "expected": "array",\n "received": "null",\n "path": [\n "data",\n "properties"\n ],\n "message": "Expected array, received null"\n }\n]", "stack": ZodError: [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ] at get error [as error] (file:///app/node_modules/zod/lib/index.mjs:538:31) at doTikoRequest (file:///app/dist/tiko/client.js:147:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async TikoClient.fetchData (file:///app/dist/tiko/client.js:47:32) at async file:///app/dist/index.js:16:27 "aggregateErrors": [ { "type": "Object", "message": "Expected array, received null", "stack":

"code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ] } ], "issues": [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ], "name": "ZodError" }`

And, for sure, I already verified credentials are the right and authentication on https://portal-engie.tiko.ch/ is a success. Could you help me? There had an update of the API pushed?

— Reply to this email directly, view it on GitHub https://github.com/marvinroger/hass-addon-tiko/issues/5, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ARH7OO7PQAOAOP3M4KXDU7TYUYBELAVCNFSM6AAAAABDTFRUFKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2DMOJRGU3DQOI

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/marvinroger/hass-addon-tiko/issues/5#issuecomment-1958076615, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARH7OO7PCZWDNMT6MRNZ7ZTYUZVMBAVCNFSM6AAAAABDTFRUFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJYGA3TMNRRGU . You are receiving this because you commented.Message ID: @.***>

dlevequeIT commented 7 months ago

Hello and thank you, I tried but it's not a some days workaround it crashes same.

Regards. -------- Message d'origine -------- Le 22 févr. 2024, 09:35, asterixmic a écrit :

Hi,

You can find it in the Tiko URL when you use the web application, after the/dashboard/ , for example https://particuliers-tiko.fr/dashboard/xxxxxxxx

But for me this workaround was ok only for few days. I am curious if it is more permanent for you.

Regards

On Wed, 21 Feb 2024, 23:03 dlevequeIT, @.***> wrote:

Hello. Thank you for your feedback. Could you tell me where find the Property Id?

Regards -------- Message d'origine -------- Le 21 févr. 2024, 17:39, asterixmic a écrit :

Hi

I have the same issues for two weeks now. It worked temporarily when I entered the Property Id.

On Wed, 21 Feb 2024, 15:37 dlevequeIT, @.***> wrote:

I setup my new Home Assistant Yellow Core device monday and I successfully integrate this addon and my devices. All worked but this morning, I saw that I was unable to control my devices. All other IoT cloud devices works, Mosquito broker is up & running but Tiko addon crash after 2sd with this message in the logs: `[15:30:08.743] ERROR (7): Failed to fetch data from Tiko; are the credentials correct? err: { "type": "ZodError", "message": "[\n {\n "code": "invalid_type",\n "expected": "array",\n "received": "null",\n "path": [\n "data",\n "properties"\n ],\n "message": "Expected array, received null"\n }\n]", "stack": ZodError: [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ] at get error [as error] (file:///app/node_modules/zod/lib/index.mjs:538:31) at doTikoRequest (file:///app/dist/tiko/client.js:147:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async TikoClient.fetchData (file:///app/dist/tiko/client.js:47:32) at async file:///app/dist/index.js:16:27 "aggregateErrors": [ { "type": "Object", "message": "Expected array, received null", "stack":

"code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ] } ], "issues": [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ], "name": "ZodError" }`

And, for sure, I already verified credentials are the right and authentication on https://portal-engie.tiko.ch/ is a success. Could you help me? There had an update of the API pushed?

— Reply to this email directly, view it on GitHub https://github.com/marvinroger/hass-addon-tiko/issues/5, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ARH7OO7PQAOAOP3M4KXDU7TYUYBELAVCNFSM6AAAAABDTFRUFKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2DMOJRGU3DQOI

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/marvinroger/hass-addon-tiko/issues/5#issuecomment-1958076615, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARH7OO7PCZWDNMT6MRNZ7ZTYUZVMBAVCNFSM6AAAAABDTFRUFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJYGA3TMNRRGU . You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

YNK22 commented 7 months ago

Hello, i have the same issue.

phid78 commented 7 months ago

Pareil pour moi depuis hier sur mon pilotage elec. Pas sur qu'il réponde, j'ai envoyé plusieurs emails ces dernières semaines sans succès...

patriarch commented 7 months ago

pareil pour moi

Swiiney commented 7 months ago

Bonjour, Thomas aurait trouvé une solution (https://forum.hacf.fr/t/gerer-ses-radiateurs-electriques-avec-home-assistant-tiko/19717/133) en récupérant des cookies obtenus à la connexion. @marvinroger, tu vois comment mettre ça dans ton code ?

Merci !

JSteunou commented 7 months ago

Credentials are not the root cause. The error message is too generic. There is now a session cookie to get back after login and return for every requests.

There is a snippet of possible fix


let csrf = ''
const csrfName = 'csrftoken'
let session = ''
const sessionName = 'USER_SESSION_member_space'

function getCookie(cookies, name) {
    const match = cookies.find(c => c.startsWith(name))?.match(new RegExp(`${name}=(\\w+);`))
    return match?.[1]
}

function parseCookies(cookies) {
    if (!session) {
        const found = getCookie(cookies, sessionName)
        if (found) session = found
    }
    if (!csrf) {
        const found = getCookie(cookies, csrfName)
        if (found) csrf = found
    }
}

async function doRequest({query, variables, token}) {
    try {
        if (session) {
            console.log(`${csrfName}=${csrf}; ${sessionName}=${session}`);
        }
        const res = await fetch("https://particuliers-tiko.fr/api/v3/graphql/", {
            method: "POST",
            headers: {
                "content-type": "application/json",
                ...(token ? { authorization: `Token ${token}` } : {}),
                ...(session ? { Cookie: `${csrfName}=${csrf}; ${sessionName}=${session}`} : {})
            },
            body: JSON.stringify({
                query,
                variables,
            }),
        })
        parseCookies(res.headers.getSetCookie())
        return res.json()
    } catch (err) {
        console.error(err);
        process.exit(1)
    }
}

to be noted: I had both csrf & session but it appears to work with session only, which is simpler for us because csrf is valid for only few hours.

marvinroger commented 7 months ago

Bonjour ! Merci à vous tous pour vos inputs, j'ai publié la 1.4.0 qui règle le souci, vous pouvez me confirmer que ça règle le souci chez vous ?

phid78 commented 7 months ago

Fonctionne pour moi sur mon pilotage elec : Mais j'ai quand meme ce message d'erreur:

[22:23:44.989] INFO (6): Connection ready
[22:23:56.857] ERROR (6): Error from state updater
    err: {
      "type": "Error",
      "message": "Request failed: fetch failed: getaddrinfo EAI_AGAIN portal-engie.tiko.ch",
      "stack":
          Error: Request failed
              at file:///app/dist/tiko/client.js:137:18
              at /app/node_modules/neverthrow/dist/index.cjs.js:100:35
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async doTikoRequest (file:///app/dist/tiko/client.js:127:28)
              at async TikoClient.fetchData (file:///app/dist/tiko/client.js:49:32)
              at async StateUpdater.update (file:///app/dist/state-updater.js:30:34)
          caused by: TypeError: fetch failed
              at node:internal/deps/undici/undici:12345:11
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async fetchCookieWrapper (file:///app/node_modules/fetch-cookie/esm/index.js:144:22)
              at async doTikoRequest (file:///app/dist/tiko/client.js:127:28)
              at async TikoClient.fetchData (file:///app/dist/tiko/client.js:49:32)
              at async StateUpdater.update (file:///app/dist/state-updater.js:30:34)
          caused by: Error: getaddrinfo EAI_AGAIN portal-engie.tiko.ch
              at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)
    }

Content d'avoir de tes nouvelles, si tu peux checker tes emails stp

marvinroger commented 7 months ago

@phid78 l'erreur EAI_AGAIN est un problème DNS, il y'a eu un problème sur le réseau entre toi et tiko. C'est complètement attendu et géré correctement, puisque ça n'a pas crashé

Swiiney commented 7 months ago

Hello, Merci pour la correction. Chez moi cela ne fonctionne pas ;-) Je suis avec Tiko et HA en mode Docker (pas de supervisor ou autre).

curl: (6) Could not resolve host: supervisor
[21:38:49] ERROR: Something went wrong contacting the API
[21:38:49] INFO: Running in standalone mode
[21:38:50.485] ERROR (6): Failed to fetch data from Tiko; are the credentials correct?
    err: {
      "type": "ZodError",
      "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"object\",\n    \"received\": \"null\",\n    \"path\": [\n      \"data\",\n      \"logIn\"\n    ],\n    \"message\": \"Expected object, received null\"\n  }\n]",
      "stack":
          ZodError: [
            {
              "code": "invalid_type",
              "expected": "object",
              "received": "null",
              "path": [
                "data",
0=l 1=o 2=g 3=I 4=n 
              ],
              "message": "Expected object, received null"
            }
          ]
              at get error [as error] (file:///app/node_modules/zod/lib/index.mjs:538:31)
              at doTikoRequest (file:///app/dist/tiko/client.js:150:31)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async TikoClient.getToken (file:///app/dist/tiko/client.js:22:28)
              at async TikoClient.fetchData (file:///app/dist/tiko/client.js:37:29)
              at async file:///app/dist/index.js:16:27
      "aggregateErrors": [
        {
          "type": "Object",
          "message": "Expected object, received null",
          "stack":

          "code": "invalid_type",
          "expected": "object",
          "received": "null",
          "path": [
            "data",
0=l 1=o 2=g 3=I 4=n 
          ]
        }
      ],
      "issues": [
        {
          "code": "invalid_type",
          "expected": "object",
          "received": "null",
          "path": [
            "data",
0=l 1=o 2=g 3=I 4=n 
          ],
          "message": "Expected object, received null"
        }
      ],
      "name": "ZodError"
    }
JSteunou commented 7 months ago

Bonjour ! Merci à vous tous pour vos inputs, j'ai publié la 1.4.0 qui règle le souci, vous pouvez me confirmer que ça règle le souci chez vous ?

Pas mal la lib fetch-cookie je ne connaissais pas, bien pratique ! J'étais partie pour te faire une PR mais avec gestion manuel des cookies comme je l'avais posté plus haut :sweat_smile:

marvinroger commented 7 months ago

@Swiiney tu es sûr à 100 % que tu as bien mis à jour ton image ? Je suis chez tiko aussi et ça a réglé mes 2 installations sans aucun soucis

@JSteunou Merci pour ta contribution ! Oui, l'API n'étant pas stateless j'ai préféré gérer les cookies comme le ferait un navigateur, si demain tiko décide de changer sa gestion des cookies l'addon sera de-facto compatible 😉

patriarch commented 7 months ago

j'ai l'impression que la mise à jour a cassé ma connexion au serveur MQTT

Capture d'écran 2024-02-23 225531 Capture d'écran 2024-02-23 225501

marvinroger commented 7 months ago

@patriarch le code MQTT n'a pour le coup pas du tout changé, redémarre ton broter MQTT, peut-être que la mise à jour a été un peu abrupte

Swiiney commented 7 months ago

@marvinroger je viens de revérifier j'utilise bien la dernière. Par acquis de conscience j'ai forcé la 1.4.0 dans le docker-compose. J'ai arrêté et supprimé l'image pour la retélécharger. J'ai toujours la même erreur.

J'ai vérifié aussi, les identifiants sont bons... Je n'avais pas changé dans le docker-compose

patriarch commented 7 months ago

@marvinroger après redémarrage du tout, c'est passé. Merci pour la correction à ceux qui ont bossé dessus.

Swiiney commented 7 months ago

C'est tombé en marche pendant la nuit.... Je me suis couché cela ne fonctionnait pas, ce matin tout remonte et je pilote. Encore merci pour la correction.

andreidobrica commented 7 months ago

Bonjour ! Merci à vous tous pour vos inputs, j'ai publié la 1.4.0 qui règle le souci, vous pouvez me confirmer que ça règle le souci chez vous ?

Thanks @marvinroger for the fix ! It works again on my side. Quick question: yesterday when I was trying to fix it manually on my side and troubleshooting with Postman, I noticed that the tiko API throws back a message limiting to 20 tries per hour. I am not sure if that's at login phase or when performing requests. Do you know anything about this? How often does the addon requests update to Tiko? Is the 1 minute hardcoded I saw in the source files?

dlevequeIT commented 7 months ago

Hello @marvinroger et toutes la commu. Un grand merci à vous pour le travail et les inputs, je ne m'attendais pas à une telle réactivité, je vous tire mon chapeau. J'ai du supprimer les anciennes intégration et réinstaller tout from scratch mais maintenant tout est à nouveau ok 👌

Avez vous fait des intégrations particulières ? Par exemples combien de pourcentage ma maison consomme en chauffage par rapport à la consommation totale (via l'onduleur SolarEdge des panneaux) ? J'ai fait mon plan 3d, c'est sympa pour les lumières mais pour les chauffages je n'ai pas d'idée.

JSteunou commented 7 months ago

Avez vous fait des intégrations particulières ? Par exemples combien de pourcentage ma maison consomme en chauffage par rapport à la consommation totale (via l'onduleur SolarEdge des panneaux) ? J'ai fait mon plan 3d, c'est sympa pour les lumières mais pour les chauffages je n'ai pas d'idée.

je t'invite à venir échanger sur le forum hacf ça sera plus pertinent qu'ici et tu auras plus de réponses ;) https://forum.hacf.fr/t/pilotez-vos-radiateurs-electriques-gratuitement-avec-tiko-mon-pilotage-elec/32790/91

JSteunou commented 7 months ago

Bonjour ! Merci à vous tous pour vos inputs, j'ai publié la 1.4.0 qui règle le souci, vous pouvez me confirmer que ça règle le souci chez vous ?

Thanks @marvinroger for the fix ! It works again on my side. Quick question: yesterday when I was trying to fix it manually on my side and troubleshooting with Postman, I noticed that the tiko API throws back a message limiting to 20 tries per hour. I am not sure if that's at login phase or when performing requests. Do you know anything about this? How often does the addon requests update to Tiko? Is the 1 minute hardcoded I saw in the source files?

I did not notice the rate limiting feedback. I do find that sometimes I cannot login anymore when doing to much test though. Is this the API response that give you this rate limit?

About the interval, you can set it from HA, it is 1 minute by default, but I set it to 6 min to avoid issues.

andreidobrica commented 7 months ago

Bonjour ! Merci à vous tous pour vos inputs, j'ai publié la 1.4.0 qui règle le souci, vous pouvez me confirmer que ça règle le souci chez vous ?

Thanks @marvinroger for the fix ! It works again on my side. Quick question: yesterday when I was trying to fix it manually on my side and troubleshooting with Postman, I noticed that the tiko API throws back a message limiting to 20 tries per hour. I am not sure if that's at login phase or when performing requests. Do you know anything about this? How often does the addon requests update to Tiko? Is the 1 minute hardcoded I saw in the source files?

I did not notice the rate limiting feedback. I do find that sometimes I cannot login anymore when doing to much test though. Is this the API response that give you this rate limit?

About the interval, you can set it from HA, it is 1 minute by default, but I set it to 6 min to avoid issues.

Yes, it's the API giving the response. I noticed 2 of them, 5/minute and 20/h But it doesn't affect the GetData, only the login. So we're good (for now... :) )

{
    "errors": [
        {
            "message": "Limite de taux atteinte. Le taux pour post:email est 20/h",
            "locations": [
                {
                    "line": 2,
                    "column": 3
                }
            ],
            "path": [
                "logIn"
            ]
        }
    ],
    "data": {
        "logIn": null
    }
}
JSteunou commented 7 months ago

But sometimes, without any errors I receive properties or any data at null, and I suspect that the graphql server does not forward rate limiting errors.

Swiiney commented 7 months ago

Il y a tout de même un truc. J'ai perdu les remontés depuis 2h. Pourtant j'ai mis un polling à 5mn. Je ne suis pas chez moi donc c'est assez limité mais Après un arrêt de 15mn et un redémarrage c'est revenu.

sebj54 commented 7 months ago

Hi there! It seems I have a similar error. I'm sure of my password because I get it from a password manager (the same I use to log in from the app).

Any idea?

Here are the logs:

[23:42:46] INFO: Running in Home Assistant mode
[23:42:46] INFO: MQTT_BROKER_URL not set, using MQTT addon service...
[23:42:47.659] ERROR (7): Failed to fetch data from Tiko; are the credentials correct?
    err: {
      "type": "ZodError",
      "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"object\",\n    \"received\": \"null\",\n    \"path\": [\n      \"data\",\n      \"logIn\"\n    ],\n    \"message\": \"Expected object, received null\"\n  }\n]",
      "stack":
          ZodError: [
            {
              "code": "invalid_type",
              "expected": "object",
              "received": "null",
              "path": [
                "data",
                "logIn"
              ],
              "message": "Expected object, received null"
            }
          ]
              at get error [as error] (file:///app/node_modules/zod/lib/index.mjs:538:31)
              at doTikoRequest (file:///app/dist/tiko/client.js:150:31)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async TikoClient.getToken (file:///app/dist/tiko/client.js:22:28)
              at async TikoClient.fetchData (file:///app/dist/tiko/client.js:37:29)
              at async file:///app/dist/index.js:16:27
      "aggregateErrors": [
        {
          "type": "Object",
          "message": "Expected object, received null",
          "stack":

          "code": "invalid_type",
          "expected": "object",
          "received": "null",
          "path": [
            "data",
            "logIn"
          ]
        }
      ],
      "issues": [
        {
          "code": "invalid_type",
          "expected": "object",
          "received": "null",
          "path": [
            "data",
            "logIn"
          ],
          "message": "Expected object, received null"
        }
      ],
      "name": "ZodError"
    }
andreidobrica commented 7 months ago

But sometimes, without any errors I receive properties or any data at null, and I suspect that the graphql server does not forward rate limiting errors.

You are probably right. I raised the update to 3 minutes so it falls under the 20/h limit. I just noticed the properties were null. Wierd is that it doesn't recover, but probably it's because of session cookies

Anyway the Tiko ecosystem itself is not very stable. Sometimes it becomes uncontrollable even with their app.... The workaroud: reboot the hub

andreidobrica commented 7 months ago

Hi there! It seems I have a similar error. I'm sure of my password because I get it from a password manager (the same I use to log in from the app).

Any idea?

Here are the logs:

[23:42:46] INFO: Running in Home Assistant mode
[23:42:46] INFO: MQTT_BROKER_URL not set, using MQTT addon service...
[23:42:47.659] ERROR (7): Failed to fetch data from Tiko; are the credentials correct?
    err: {
      "type": "ZodError",
      "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"object\",\n    \"received\": \"null\",\n    \"path\": [\n      \"data\",\n      \"logIn\"\n    ],\n    \"message\": \"Expected object, received null\"\n  }\n]",
      "stack":
          ZodError: [
            {
              "code": "invalid_type",
              "expected": "object",
              "received": "null",
              "path": [
                "data",
                "logIn"
              ],
              "message": "Expected object, received null"
            }
          ]
              at get error [as error] (file:///app/node_modules/zod/lib/index.mjs:538:31)
              at doTikoRequest (file:///app/dist/tiko/client.js:150:31)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async TikoClient.getToken (file:///app/dist/tiko/client.js:22:28)
              at async TikoClient.fetchData (file:///app/dist/tiko/client.js:37:29)
              at async file:///app/dist/index.js:16:27
      "aggregateErrors": [
        {
          "type": "Object",
          "message": "Expected object, received null",
          "stack":

          "code": "invalid_type",
          "expected": "object",
          "received": "null",
          "path": [
            "data",
            "logIn"
          ]
        }
      ],
      "issues": [
        {
          "code": "invalid_type",
          "expected": "object",
          "received": "null",
          "path": [
            "data",
            "logIn"
          ],
          "message": "Expected object, received null"
        }
      ],
      "name": "ZodError"
    }

Upgrade to the latest version. It has been fixed. I think the issue can be closed

sebj54 commented 7 months ago

Actually it is the last version: 1.4.0. I installed for the first time yesterday.

Najihel commented 7 months ago

Bonjour,

Même problème chez moi en dernière version

"type": "ZodError", "message": "[\n {\n \"code\": \"invalid_type\",\n \"expected\": \"array\",\n \"received\": \"null\",\n \"path\": [\n \"data\",\n \"properties\"\n ],\n \"message\": \"Expected array, received null\"\n }\n]", "stack": ZodError: [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ] at get error [as error] (file:///app/node_modules/zod/lib/index.mjs:538:31) at doTikoRequest (file:///app/dist/tiko/client.js:150:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async TikoClient.fetchData (file:///app/dist/tiko/client.js:49:32) at async StateUpdater.update (file:///app/dist/state-updater.js:30:34) "aggregateErrors": [ { "type": "Object", "message": "Expected array, received null", "stack": "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ] } ], "issues": [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ], "name": "ZodError" } [08:04:04.370] ERROR (6): Error from state updater err: { "type": "ZodError", "message": "[\n {\n \"code\": \"invalid_type\",\n \"expected\": \"array\",\n \"received\": \"null\",\n \"path\": [\n \"data\",\n \"properties\"\n ],\n \"message\": \"Expected array, received null\"\n }\n]", "stack": ZodError: [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ] at get error [as error] (file:///app/node_modules/zod/lib/index.mjs:538:31) at doTikoRequest (file:///app/dist/tiko/client.js:150:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async TikoClient.fetchData (file:///app/dist/tiko/client.js:49:32) at async StateUpdater.update (file:///app/dist/state-updater.js:30:34) "aggregateErrors": [ { "type": "Object", "message": "Expected array, received null", "stack": "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ] } ], "issues": [ { "code": "invalid_type", "expected": "array", "received": "null", "path": [ "data", "properties" ], "message": "Expected array, received null" } ], "name": "ZodError" }

Un redémarrage de l'addon et ça refonctionne

JSteunou commented 7 months ago

J'ai ouvert une nouvelle issue dédiée https://github.com/marvinroger/hass-addon-tiko/issues/6

celle-ci devrait être fermée.

marvinroger commented 7 months ago

Bonjour à tous,

L'erreur "are the credentials correct?" est en effet dûe à un rate limiting de la part de tiko. J'ai mis à jour l'add-on en version 1.4.1 qui devrait mieux gérer ce souci et qui règle également le cœur du problème (#6).

Je laisse l'issue ouverte, n'hésitez pas à me dire si tout est OK pour vous et je la fermerai dans quelques jours. 😉

Merci à tous pour votre implication et plus particulièrement à @JSteunou qui a bien défriché le sujet et m'a aidé à gagner du temps ! 💯

Swiiney commented 7 months ago

Hello @marvinroger, depuis la 1.4.1, chez moi, ce n'est pas mieux car cela semble fonctionner mais au bout d'un moment les températures ne se mettent pas à jour et je ne peux plus changer les cibles. Un exemple de message d'erreur :

[13:44:28.313] INFO (7): Setting room target temperature
    propertyId: 220020078
    roomId: 220016196
    targetTemperature: 18
[13:44:28.382] ERROR (7): Failed to set target temperature
    err: {
      "type": "Error",
      "message": "The tiko API returned an error: {\"errors\":[{\"message\":\"Vous n’avez pas la permission d’effectuer cette action. Server: PERMISSION_DENIED AnonymousUser\"}]}",
      "stack":
          Error: The tiko API returned an error: {"errors":[{"message":"Vous n’avez pas la permission d’effectuer cette action. Server: PERMISSION_DENIED AnonymousUser"}]}
              at doTikoRequest (file:///app/dist/tiko/client.js:161:24)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async TikoClient.setRoomTargetTemperature (file:///app/dist/tiko/client.js:81:32)
              at async MqttCommandHandler.handleMessage (file:///app/dist/mqtt-command-handler.js:45:32)
    }

Un redémarrage du container résout le problème jusqu'au prochain timeout.

YNK22 commented 7 months ago

J'ai le même soucis que @Swiiney, la connexion est ok mais j'ai l'impression qu'il ne bypass pas la programmation des températures de consigne de l'application tiko, j'aimerai rester avec l'addon tiko et versatile thermostat sur HA plutôt que l'application tiko (parce que j'ai un soucis avec leurs capteurs de température qui n'ont pas l'air cohérent)

marvinroger commented 6 months ago

@Swiiney la 1.4.2 devrait corriger le souci !

Swiiney commented 6 months ago

Merci je testerais demain (en jour rouge j'ai préféré assuré le coup avec la 1.4.0 et un cron qui redémarre le container toutes les 5h)

En tout cas merci pour le boulot

YNK22 commented 6 months ago

@Swiiney la 1.4.2 devrait corriger le souci !

J'ai toujours le même soucis en 1.4.2

Swiiney commented 6 months ago

En effet toujours une erreur au bout d'un moment :

[04:18:55.742] ERROR (7): Error from state updater
    err: {
      "type": "Error",
      "message": "The tiko API returned an error: {\"errors\":[{\"message\":\"Vous n’avez pas la permission d’effectuer cette action. Server: PERMISSION_DENIED AnonymousUser\"}]}",
      "stack":
          Error: The tiko API returned an error: {"errors":[{"message":"Vous n’avez pas la permission d’effectuer cette action. Server: PERMISSION_DENIED AnonymousUser"}]}
              at doTikoRequest (file:///app/dist/tiko/client.js:161:24)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async TikoClient.fetchData (file:///app/dist/tiko/client.js:57:32)
              at async StateUpdater.update (file:///app/dist/state-updater.js:30:34)
    }
marvinroger commented 6 months ago

Le jeton n'était en fait valide que 10 heures et pas 12, le 1.4.3 rafraîchit le jeton toutes les 5 heures, tu peux me dire si c'est bon pour toi @Swiiney ?

Swiiney commented 6 months ago

Cela semble bon. En tout cas, cela fait 15h que l'add-on fonctionne (depuis 6h30 ce matin) et j'ai toujours les températures et le pilotage. J'ai tout de même eu une erreur dans la journée mais peut-être une indispo des serveurs Tiko :

[12:50:11.588] INFO (7): Setting room target temperature
    propertyId: 220020078
    roomId: 220016597
    targetTemperature: 19
[16:16:00.497] ERROR (7): Error from state updater
    err: {
      "type": "Error",
      "message": "The tiko API returned an error: {\"errors\":[{\"message\":\"Could not retrieve fast consumption data\"},{\"message\":\"Could not connect to any of [('172.20.65.39', 30032)]\"}]}",
      "stack":
          Error: The tiko API returned an error: {"errors":[{"message":"Could not retrieve fast consumption data"},{"message":"Could not connect to any of [('172.20.65.39', 30032)]"}]}
              at doTikoRequest (file:///app/dist/tiko/client.js:162:24)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async TikoClient.fetchData (file:///app/dist/tiko/client.js:58:32)
              at async StateUpdater.update (file:///app/dist/state-updater.js:30:34)
    }
[17:45:43.501] INFO (7): Setting room target temperature
    propertyId: 220020078
    roomId: 220016193
    targetTemperature: 18

En tout cas merci pour le boulot @marvinroger

marvinroger commented 6 months ago

Merci à toi @Swiiney ! Le bug d'origine est donc corrigé

L'erreur "fast consumption" est un problème chez tiko, en effet. L'add-on réagit bien puisqu'il ne crash pas et se rattrape par la suite.

Merci à tous pour vos inputs.