OBone-git / Cozytouch-domoticz

Python script for read/write data between the cozytouch server and domoticz on rpi
MIT License
17 stars 15 forks source link

problème lecture statut module fil pilote #27

Closed wallb35 closed 2 years ago

wallb35 commented 2 years ago

depuis la version 5, le script ne lit plus les données module_fil_pilote, a chaque exécution le script retourne l'erreur suivante ci-dessous. le script fonctionnait dans les version précédentes. Cette erreur apparait toujours suite à la correction [(https://github.com/OBone-git/Cozytouch-domoticz/tree/Correction-fil-pilote)]. A noter que si je commente la partie "name == dict_cozytouch_devtypes.get(u'module fil pilote') or " de la ligne 1272 le script fonctionne sans erreur et remonte les données de mes radiateurs connectés (et évidemment pas celles des modules_fil_pilote). Ma config : 7 modules fil pilote et 2 radiateurs connectés tous de marque sauter.

Tâche : Cozytouch V5.2 Heure de début : Tue, 23 Nov 2021 10:59:45 GMT Heure d'arrêt : Tue, 23 Nov 2021 10:59:48 GMT État actuel : 1 (Interrompu) Sortie/erreur standard : ¤¤¤¤ Demarrage script cozytouch <=> domoticz version 5.2 (debug :1) Version python : 2.7.18 Test existence / creation configuration cozytouch (hardware domoticz + fichier de sauvegarde) Fichier de sauvegarde de la configuration : /volume1/homes/admin/domoticz/scripts/cozytouch_save idx hardware cozytouch dans le fichier de sauvegarde de la configuration : 25 GET-> http://192.168.1.23:8084/json.htm?type=hardware : 200 idx hardware cozytouch dans domoticz : 25 Fin fonction test Test présence du fichier de sauvegarde cozytouch et virtual hardware domoticz OK

Tentative interrogation serveur Cozytouch sans login, avec cookie login précédent GET-> https://ha110-1.overkiz.com/enduser-mobile-web/externalAPI/json/refreshAllStates : 200 Requete de test sans login reussie, bypass login

Decouverte devices GET-> https://ha110-1.overkiz.com/enduser-mobile-web/externalAPI/json/getSetup : 200

Gateway Cozytouch : etat on / connexion : OK / version : 2021.5.4

Demarrage mise a jour devices Mise a jour device 0 : io:AtlanticElectricalHeaterIOComponent GET-> http://192.168.1.23:8084/json.htm?type=devices&rid=None : 200 Traceback (most recent call last): File "/volume1/homes/admin/domoticz/scripts/cozytouch.py", line 1596, in decouverte_devices() File "/volume1/homes/admin/domoticz/scripts/cozytouch.py", line 688, in decouverte_devices maj_device(data,name,p,x) # mise à jour du device File "/volume1/homes/admin/domoticz/scripts/cozytouch.py", line 1277, in maj_device level_0=u'off',level_10=u'frostprotection',level_20=u'eco',level_30=u'comfort-2',level_40=u'comfort-1',level_50=u'comfort',setting_command_mode=u'io:TargetHeatingLevelState') File "/volume1/homes/admin/domoticz/scripts/cozytouch.py", line 1150, in gestion_switch_selector_domoticz domoticz_switch_actual = domoticz_read_device_switch_selector(idx_switch_domoticz) File "/volume1/homes/admin/domoticz/scripts/cozytouch.py", line 196, in domoticz_read_device_switch_selector return data[u'result'][0][u'LevelInt'] KeyError: u'result'

OBone-git commented 2 years ago

Bonjour, quelques corrections. Après test chez moi je n'ai pas l'erreur u'[result]. Peux tu ré-essayer avec ce pull #31 ?

wallb35 commented 2 years ago

Hello Obone, cette correction ne corrige pas le bug u'result' mais un bug précédent. sans cette correction le script s'arrête avant le bug u'result'. Yannig

OBone-git commented 2 years ago

Peux tu relever le numéro d'idx du sélecteur créé dans la liste des devices et ensuite passe cette requete depuis un navigateur web :

Avec cette @ip pour exemple: http://192.168.1.1:8080/json.htm?type=devices&rid="ton idx ici"

Tu devrais avoir des données JSON avec un [result] bien visible.

wallb35 commented 2 years ago

l'url de mon premier device est : http://192.168.1.23:8084/json.htm?type=devices&rid=195 et ça donne le json ci-dessous. cependant l'url qui plante est avec un rid=None ce qui ne peut effectivement rien retourner. pourquoi est-ce que le script lance une url : http://192.168.1.23:8084/json.htm?type=devices&rid=None ?

{ "ActTime" : 1638199271, "AstrTwilightEnd" : "19:09", "AstrTwilightStart" : "06:43", "CivTwilightEnd" : "17:53", "CivTwilightStart" : "07:59", "DayLength" : "08:43", "NautTwilightEnd" : "18:32", "NautTwilightStart" : "07:20", "ServerTime" : "2021-11-29 16:21:11", "SunAtSouth" : "12:56", "Sunrise" : "08:34", "Sunset" : "17:17", "app_version" : "2021.1", "result" : [ { "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 15, "Data" : "Off", "Description" : "", "DimmerType" : "none", "Favorite" : 0, "HardwareDisabled" : false, "HardwareID" : 25, "HardwareName" : "Cozytouch_V5.2", "HardwareType" : "Dummy (Does nothing, use for virtual switches only)", "HardwareTypeVal" : 15, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "00014113", "Image" : "Heating", "IsSubDevice" : false, "LastUpdate" : "2021-11-23 10:58:33", "Level" : 0, "LevelActions" : "fHx8fHw=", "LevelInt" : 0, "LevelNames" : "T2ZmfEhvcnMgZ2VsfEVjb3xDb25mb3J0IC0yfENvbmZvcnQgLTF8Q29uZm9ydA==", "LevelOffHidden" : false, "MaxDimLevel" : 100, "Name" : "Mode Module fil pilote Parentale", "Notifications" : "false", "PlanID" : "0", "PlanIDs" : [ 0 ], "Protected" : false, "SelectorStyle" : 1, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "Off", "StrParam1" : "", "StrParam2" : "", "SubType" : "Selector Switch", "SwitchType" : "Selector", "SwitchTypeVal" : 18, "Timers" : "false", "Type" : "Light/Switch", "TypeImg" : "Light", "Unit" : 1, "Used" : 1, "UsedByCamera" : false, "XOffset" : "0", "YOffset" : "0", "idx" : "195" } ], "status" : "OK", "title" : "Devices" }

Le lun. 29 nov. 2021 à 16:11, OBone-git @.***> a écrit :

Peux tu relever le numéro d'idx du sélecteur créé dans la liste des devices et ensuite passe cette requete depuis un navigateur web :

Avec cette @ip https://github.com/ip pour exemple: http://192.168.1.1:8080/json.htm?type=devices&rid="ton idx ici"

Tu devrais avoir des données JSON avec un [result] bien visible.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OBone-git/Cozytouch-domoticz/issues/27#issuecomment-981726524, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWB3HCDPMQTO3LWSVC7FX2TUOOJ2VANCNFSM5ITC6D2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

OBone-git commented 2 years ago

Oui. Ce n'est pas normal,la requete doit contenir le numéro d'idx enregistré lors de la création du widget, le script stocke cette info dans le fichier cozytouch_save. 2 solutions : soit effacer le matériel cozytouch et refaire la procédure d'ajout, soit modifier "en dur" dans le fichier cozytouch_save pour vérifier et corriger l'idx si tu veux garder ton historique de T°C par exemple (pas l'habitude de faire cette manip mais en théorie faisable). Dans ce cas regarde ou envoie moi ton fichier.

wallb35 commented 2 years ago

merci, voici le fichier en pj.

Le lun. 29 nov. 2021 à 17:50, OBone-git @.***> a écrit :

Oui. Ce n'est pas normal,la requete doit contenir le numéro d'idx enregistré lors de la création du widget, le script stocke cette info dans le fichier cozytouch_save. 2 solutions : soit effacer le matériel cozytouch et refaire la procédure d'ajout, soit modifier "en dur" dans le fichier cozytouch_save pour vérifier et corriger l'idx si tu veux garder ton historique de T°C par exemple (pas l'habitude de faire cette manip mais en théorie faisable). Dans ce cas regarde ou envoie moi ton fichier.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OBone-git/Cozytouch-domoticz/issues/27#issuecomment-981818372, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWB3HCHLSXLENQ53C7CXLPTUOOVMJANCNFSM5ITC6D2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

OBone-git commented 2 years ago

Je ne vois pas le fichier que tu as ajouté

wallb35 commented 2 years ago

mince, j'essaye zippé. note que ça fait plusieurs fois que je supprime le fichier cozytouch_save. le problème vient peut-etre de la création du fichier ?

Le lun. 29 nov. 2021 à 21:44, OBone-git @.***> a écrit :

Je ne vois pas le fichier que tu as ajouté

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OBone-git/Cozytouch-domoticz/issues/27#issuecomment-982005716, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWB3HCBN76QDNR6UKJCBKYDUOPQ2LANCNFSM5ITC6D2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

OBone-git commented 2 years ago

Pareil, passe par le forum pour me l'envoyer par mail. Merci

wallb35 commented 2 years ago

le forum domoticz m'interdit d'envoyer des fichiers, quelque soit l'extension du fichier. ERREUR

Extension de fichier non prise en charge :

Le mar. 30 nov. 2021 à 15:15, OBone-git @.***> a écrit :

Pareil, passe par le forum pour me l'envoyer par mail. Merci

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OBone-git/Cozytouch-domoticz/issues/27#issuecomment-982676326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWB3HCAHNUGXVVWJXHVGBUTUOTMARANCNFSM5ITC6D2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

OBone-git commented 2 years ago

Bonjour, tu peux tester cette version #35

wallb35 commented 2 years ago

Hello, perfect ! tout semble fonctionner désormais ! Merci OBone ! Yannig

Le mer. 1 déc. 2021 à 14:05, OBone-git @.***> a écrit :

Bonjour, tu peux tester cette version #35 https://github.com/OBone-git/Cozytouch-domoticz/pull/35

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OBone-git/Cozytouch-domoticz/issues/27#issuecomment-983621690, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWB3HCFMR5XVHVPJYGHGPLLUOYMTLANCNFSM5ITC6D2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.