FilipDem / Domoticz-BMW-plugin

Domoticz plugin working with BMW Connected Drive
4 stars 2 forks source link

plugin out or order since 24h #5

Closed tsrz closed 3 years ago

tsrz commented 3 years ago

Hi Filip,

since yesterday my plugin look to have a problem i restarted Domoticz and the raspeberry pi but same problem, i join you my log (i just remove my login/password) thanks for your help

best regards Fred

2021-08-06 10:19:51.075 Mini: (Mini) API Mode used: New 2021-08-06 10:19:51.076 Mini: (Mini) Pushing 'WriteDirective' on to queue 2021-08-06 10:19:51.076 (Mini) Processing 'WriteDirective' message 2021-08-06 10:19:51.076 Mini: (Mini) Sending 532 bytes of data 2021-08-06 10:19:51.076 Mini: (Mini) 50 4f 53 54 20 2f 67 63 64 6d 2f 6f 61 75 74 68 2f 74 6f 6b POST./gcdm/oauth/tok 2021-08-06 10:19:51.076 Mini: (Mini) 65 6e 20 48 54 54 50 2f 31 2e 31 0d 0a 43 6f 6e 74 65 6e 74 en.HTTP/1.1..Content 2021-08-06 10:19:51.076 Mini: (Mini) 2d 54 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 -Type:.application/x 2021-08-06 10:19:51.076 Mini: (Mini) 2d 77 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 -www-form-urlencoded 2021-08-06 10:19:51.077 Mini: (Mini) 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 31 ..Content-Length:.11 2021-08-06 10:19:51.077 Mini: (Mini) 33 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 4b 65 65 70 2d 3..Connection:.Keep- 2021-08-06 10:19:51.077 Mini: (Mini) 41 6c 69 76 65 0d 0a 48 6f 73 74 3a 20 63 75 73 74 6f 6d 65 Alive..Host:.custome 2021-08-06 10:19:51.077 Mini: (Mini) 72 2e 62 6d 77 67 72 6f 75 70 2e 63 6f 6d 0d 0a 41 63 63 65 r.bmwgroup.com..Acce 2021-08-06 10:19:51.077 Mini: (Mini) 70 74 2d 45 6e 63 6f 64 69 6e 67 3a 20 6a 73 6f 6e 0d 0a 41 pt-Encoding:.json..A 2021-08-06 10:19:51.077 Mini: (Mini) 75 74 68 6f 72 69 7a 61 74 69 6f 6e 3a 20 42 61 73 69 63 20 uthorization:.Basic. 2021-08-06 10:19:51.077 Mini: (Mini) 5a 44 63 32 4e 6d 49 31 4d 7a 63 74 59 54 59 31 4e 43 30 30 ZDc2NmI1MzctYTY1NC00 2021-08-06 10:19:51.077 Mini: (Mini) 59 32 4a 6b 4c 57 45 7a 5a 47 4d 74 4d 47 4e 68 4e 54 59 33 Y2JkLWEzZGMtMGNhNTY3 2021-08-06 10:19:51.077 Mini: (Mini) 4d 6d 51 33 5a 6a 68 6b 4f 6a 45 31 5a 6a 59 35 4e 32 59 32 MmQ3ZjhkOjE1ZjY5N2Y2 2021-08-06 10:19:51.077 Mini: (Mini) 4c 57 45 31 5a 44 55 74 4e 47 4e 68 5a 43 30 35 4f 57 51 35 LWE1ZDUtNGNhZC05OWQ5 2021-08-06 10:19:51.078 Mini: (Mini) 4c 54 4e 68 4d 54 56 69 59 7a 64 6d 4d 7a 6b 33 4d 77 3d 3d LTNhMTViYzdmMzk3Mw== 2021-08-06 10:19:51.078 Mini: (Mini) 0d 0a 43 72 65 64 65 6e 74 69 61 6c 73 3a 20 6e 51 76 36 43 ..Credentials:.nQv6C 2021-08-06 10:19:51.078 Mini: (Mini) 71 74 78 4a 75 58 57 50 37 34 78 66 33 43 4a 77 55 45 50 3a qtxJuXWP74xf3CJwUEP: 2021-08-06 10:19:51.078 Mini: (Mini) 31 7a 44 48 78 36 75 6e 34 63 44 6a 79 62 4c 45 4e 4e 33 6b 1zDHx6un4cDjybLENN3k 2021-08-06 10:19:51.078 Mini: (Mini) 79 66 75 6d 58 32 6b 45 59 69 67 57 50 63 51 70 64 76 44 52 yfumX2kEYigWPcQpdvDR 2021-08-06 10:19:51.078 Mini: (Mini) 70 49 42 6b 37 72 4f 4a 0d 0a 55 73 65 72 2d 41 67 65 6e 74 pIBk7rOJ..User-Agent 2021-08-06 10:19:51.078 Mini: (Mini) 3a 20 6f 6b 68 74 74 70 2f 33 2e 31 32 2e 32 0d 0a 0d 0a 73 :.okhttp/3.12.2....s 2021-08-06 10:19:51.078 Mini: (Mini) 63 6f 70 65 3d 61 75 74 68 65 6e 74 69 63 61 74 65 5f 75 73 cope=authenticate_us 2021-08-06 10:19:51.078 Mini: (Mini) 65 72 2b 76 65 68 69 63 6c 65 5f 64 61 74 61 2b 72 65 6d 6f er+vehicle_data+remo 2021-08-06 10:19:51.078 Mini: (Mini) 74 65 5f 73 65 72 76 69 63 65 73 26 75 73 65 72 6e 61 6d 65 te_services&username 2021-08-06 10:19:51.078 Mini: (Mini) 3d 74 73 72 25 34 30 66 72 65 65 2e 66 72 26 70 61 73 73 77 =myuser%40free.fr&passw 2021-08-06 10:19:51.079 Mini: (Mini) 6f 72 64 3d 50 69 6e 67 6f 75 31 6e 26 67 72 61 6e 74 5f 74 ord=mypassword&grant_t 2021-08-06 10:19:51.079 Mini: (Mini) 79 70 65 3d 70 61 73 73 77 6f 72 64 .. .. .. .. .. .. .. .. ype=password 2021-08-06 10:19:51.227 Mini: (Mini) Pushing 'ReadEvent' on to queue 2021-08-06 10:19:51.230 (Mini) Processing 'ReadEvent' message 2021-08-06 10:19:51.231 Mini: (Mini) Received 961 bytes of data 2021-08-06 10:19:51.231 Mini: (Mini) 48 54 54 50 2f 31 2e 31 20 34 30 30 20 42 61 64 20 52 65 71 HTTP/1.1.400.Bad.Req 2021-08-06 10:19:51.232 Mini: (Mini) 75 65 73 74 0d 0a 44 61 74 65 3a 20 46 72 69 2c 20 30 36 20 uest..Date:.Fri,.06. 2021-08-06 10:19:51.233 Mini: (Mini) 41 75 67 20 32 30 32 31 20 30 38 3a 31 39 3a 35 31 20 47 4d Aug.2021.08:19:51.GM 2021-08-06 10:19:51.233 Mini: (Mini) 54 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 70 T..Content-Type:.app 2021-08-06 10:19:51.234 Mini: (Mini) 6c 69 63 61 74 69 6f 6e 2f 6a 73 6f 6e 0d 0a 54 72 61 6e 73 lication/json..Trans 2021-08-06 10:19:51.234 Mini: (Mini) 66 65 72 2d 45 6e 63 6f 64 69 6e 67 3a 20 63 68 75 6e 6b 65 fer-Encoding:.chunke 2021-08-06 10:19:51.234 Mini: (Mini) 64 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b 65 65 70 2d d..Connection:.keep- 2021-08-06 10:19:51.234 Mini: (Mini) 61 6c 69 76 65 0d 0a 58 2d 43 6f 72 72 65 6c 61 74 69 6f 6e alive..X-Correlation 2021-08-06 10:19:51.235 Mini: (Mini) 49 44 3a 20 49 64 2d 61 37 66 30 30 63 36 31 61 31 36 36 34 ID:.Id-a7f00c61a1664 2021-08-06 10:19:51.235 Mini: (Mini) 66 65 34 64 61 32 63 63 63 65 30 20 30 0d 0a 57 57 57 2d 41 fe4da2ccce0.0..WWW-A 2021-08-06 10:19:51.235 Mini: (Mini) 75 74 68 65 6e 74 69 63 61 74 65 3a 20 42 61 73 69 63 20 72 uthenticate:.Basic.r 2021-08-06 10:19:51.235 Mini: (Mini) 65 61 6c 6d 3d 22 44 65 66 61 75 6c 74 52 65 61 6c 6d 22 0d ealm="DefaultRealm". 2021-08-06 10:19:51.235 Mini: (Mini) 0a 41 63 63 65 73 73 2d 43 6f 6e 74 72 6f 6c 2d 41 6c 6c 6f .Access-Control-Allo 2021-08-06 10:19:51.235 Mini: (Mini) 77 2d 4f 72 69 67 69 6e 3a 20 0d 0a 41 63 63 65 73 73 2d 43 w-Origin:...Access-C 2021-08-06 10:19:51.235 Mini: (Mini) 6f 6e 74 72 6f 6c 2d 41 6c 6c 6f 77 2d 48 65 61 64 65 72 73 ontrol-Allow-Headers 2021-08-06 10:19:51.235 Mini: (Mini) 3a 20 41 75 74 68 6f 72 69 7a 61 74 69 6f 6e 2c 20 4f 72 69 :.Authorization,.Ori 2021-08-06 10:19:51.235 Mini: (Mini) 67 69 6e 2c 20 58 2d 63 32 62 2d 41 75 74 68 6f 72 69 7a 61 gin,.X-c2b-Authoriza 2021-08-06 10:19:51.235 Mini: (Mini) 74 69 6f 6e 2c 20 58 2d 63 32 62 2d 6d 54 41 4e 2c 20 58 2d tion,.X-c2b-mTAN,.X- 2021-08-06 10:19:51.235 Mini: (Mini) 52 65 71 75 65 73 74 65 64 2d 57 69 74 68 2c 20 58 2d 63 32 Requested-With,.X-c2 2021-08-06 10:19:51.235 Mini: (Mini) 62 2d 53 65 6e 64 65 72 2d 49 64 2c 20 58 2d 63 32 62 2d 45 b-Sender-Id,.X-c2b-E 2021-08-06 10:19:51.236 Mini: (Mini) 78 74 65 72 6e 61 6c 2d 49 64 2c 20 43 6f 6e 74 65 6e 74 2d xternal-Id,.Content- 2021-08-06 10:19:51.236 Mini: (Mini) 54 79 70 65 2c 20 41 63 63 65 70 74 2c 20 43 61 63 68 65 2d Type,.Accept,.Cache- 2021-08-06 10:19:51.236 Mini: (Mini) 43 6f 6e 74 72 6f 6c 2c 20 4b 65 79 49 64 0d 0a 41 63 63 65 Control,.KeyId..Acce 2021-08-06 10:19:51.236 Mini: (Mini) 73 73 2d 43 6f 6e 74 72 6f 6c 2d 4d 61 78 2d 41 67 65 3a 20 ss-Control-Max-Age:. 2021-08-06 10:19:51.236 Mini: (Mini) 33 36 32 38 38 30 30 0d 0a 41 63 63 65 73 73 2d 43 6f 6e 74 3628800..Access-Cont 2021-08-06 10:19:51.236 Mini: (Mini) 72 6f 6c 2d 41 6c 6c 6f 77 2d 43 72 65 64 65 6e 74 69 61 6c rol-Allow-Credential 2021-08-06 10:19:51.236 Mini: (Mini) 73 3a 20 74 72 75 65 0d 0a 41 63 63 65 73 73 2d 43 6f 6e 74 s:.true..Access-Cont 2021-08-06 10:19:51.236 Mini: (Mini) 72 6f 6c 2d 41 6c 6c 6f 77 2d 4d 65 74 68 6f 64 73 3a 20 50 rol-Allow-Methods:.P 2021-08-06 10:19:51.236 Mini: (Mini) 4f 53 54 2c 20 47 45 54 2c 20 4f 50 54 49 4f 4e 53 2c 20 50 OST,.GET,.OPTIONS,.P 2021-08-06 10:19:51.236 Mini: (Mini) 55 54 2c 20 44 45 4c 45 54 45 2c 20 48 45 41 44 0d 0a 52 65 UT,.DELETE,.HEAD..Re 2021-08-06 10:19:51.236 Mini: (Mini) 66 65 72 72 65 72 2d 50 6f 6c 69 63 79 3a 20 6e 6f 2d 72 65 ferrer-Policy:.no-re 2021-08-06 10:19:51.236 Mini: (Mini) 66 65 72 72 65 72 2d 77 68 65 6e 2d 64 6f 77 6e 67 72 61 64 ferrer-when-downgrad 2021-08-06 10:19:51.237 Mini: (Mini) 65 0d 0a 0d 0a 31 33 30 0d 0a 7b 22 65 72 72 6f 72 22 3a 20 e....130..{"error":. 2021-08-06 10:19:51.237 Mini: (Mini) 22 69 6e 76 61 6c 69 64 5f 72 65 71 75 65 73 74 22 2c 20 22 "invalid_request",." 2021-08-06 10:19:51.237 Mini: (Mini) 65 72 72 6f 72 5f 64 65 73 63 72 69 70 74 69 6f 6e 22 3a 20 error_description":. 2021-08-06 10:19:51.237 Mini: (Mini) 22 54 68 65 20 72 65 71 75 65 73 74 20 69 73 20 6d 69 73 73 "The.request.is.miss 2021-08-06 10:19:51.237 Mini: (Mini) 69 6e 67 20 61 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d ing.a.required.param 2021-08-06 10:19:51.237 Mini: (Mini) 65 74 65 72 2c 20 69 6e 63 6c 75 64 65 73 20 61 6e 20 75 6e eter,.includes.an.un 2021-08-06 10:19:51.237 Mini: (Mini) 73 75 70 70 6f 72 74 65 64 20 70 61 72 61 6d 65 74 65 72 20 supported.parameter. 2021-08-06 10:19:51.237 Mini: (Mini) 76 61 6c 75 65 20 28 6f 74 68 65 72 20 74 68 61 6e 20 67 72 value.(other.than.gr 2021-08-06 10:19:51.237 Mini: (Mini) 61 6e 74 20 74 79 70 65 29 2c 20 72 65 70 65 61 74 73 20 61 ant.type),.repeats.a 2021-08-06 10:19:51.237 Mini: (Mini) 20 70 61 72 61 6d 65 74 65 72 2c 20 69 6e 63 6c 75 64 65 73 .parameter,.includes 2021-08-06 10:19:51.237 Mini: (Mini) 20 6d 75 6c 74 69 70 6c 65 20 63 72 65 64 65 6e 74 69 61 6c .multiple.credential 2021-08-06 10:19:51.237 Mini: (Mini) 73 2c 20 75 74 69 6c 69 7a 65 73 20 6d 6f 72 65 20 74 68 61 s,.utilizes.more.tha 2021-08-06 10:19:51.238 Mini: (Mini) 6e 20 6f 6e 65 20 6d 65 63 68 61 6e 69 73 6d 20 66 6f 72 20 n.one.mechanism.for. 2021-08-06 10:19:51.238 Mini: (Mini) 61 75 74 68 65 6e 74 69 63 61 74 69 6e 67 20 74 68 65 20 63 authenticating.the.c 2021-08-06 10:19:51.238 Mini: (Mini) 6c 69 65 6e 74 2c 20 6f 72 20 69 73 20 6f 74 68 65 72 77 69 lient,.or.is.otherwi 2021-08-06 10:19:51.238 Mini: (Mini) 73 65 20 6d 61 6c 66 6f 72 6d 65 64 22 7d 0d 0a 30 0d 0a 0d se.malformed"}..0... 2021-08-06 10:19:51.238 Mini: (Mini) 0a .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . 2021-08-06 10:19:51.238 Mini: (Mini) Pushing 'onMessageCallback' on to queue 2021-08-06 10:19:51.238 (Mini) Processing 'onMessageCallback' message 2021-08-06 10:19:51.238 Mini: (Mini) Calling message handler 'onMessage'. 2021-08-06 10:19:51.239 Mini: (Mini) onMessage called (BmwAuth)

FilipDem commented 3 years ago

Hi, I had already seen it because I have the same problem. Probably BMW changed something... Unfortunately I am abroad on holiday and cannot take a look at it (no PC)... I am off until end of August. I will take a look then. And there will be new features I have prepared and testing now: new device to have the kilometres per day and possibility to open and close the car + a script that warns when the car is not closed. So see you later with an update...

tsrz commented 3 years ago

hi, ok, no problem, fix it when you have time ... enjoy your holidays

Fred

Vondee commented 3 years ago

Same with me. 'the request is missing a required parameter'. The plugin worked fine till August 5.

FilipDem commented 3 years ago

Back from holiday... Problem is indeed that BMW stopped the support of BMW Connected Drive App and the linked authentication services. As MyBMW App is using other authentication services, I needed to update the authentication mechanism.

As it also annoyed me, I made a new version that already works again for the update. The remote services are not yet checked/updated.

It works at my side... Authentication codes have only a limited lifetime (was also in the previous version), however I haven't had the case yet that the lifetime is expired (and thus new authentication codes are required). I suppose this should work, but cannot guarantee it yet as we need to run the plugin a long time.

As it is a temporary version, I upload the new version here. You will need to restart Domoticz (as the hardware settings page changed) and enter again your credentials.

Any feedback is already welcome (as I am still busy with it).

(remove the .txt extension!) plugin.py.txt

FilipDem commented 3 years ago

Final version is committed! Remote services also work! It is strongly advised to delete the device "REMOTE_SERVICES" before updating. The device will automatically be created.

People using the plugin, but not yet donated... All (financial) support is welcome :-). It cost me the whole day to align with new BMW APIs.

F

tsrz commented 3 years ago

thanks for the update but problem for me i delete the device "REMOTE_SERVICES" as you advised but after upgrade, domoticz stop to work after 5 sec just after entering my login pwd in the plugin page can you confirm me that the new 'security question' field is the pin code created in the phone app ?

FilipDem commented 3 years ago

Did you do a restart of Domoticz after the update of the plugin? As mentioned in the comments before you should do it as the settings info changed. You will also need to enter you password and username. You can ignore the security question. It is 'ot used anymore. Could you send me the log when the crash is still there? I my case it is running since Saturday... F

Op ma 30 aug. 2021 15:10 schreef tsrz @.***>:

thanks for the update but problem for me i delete the device "REMOTE_SERVICES" as you advised but after upgrade, domoticz stop to work after 5 sec just after entering my login pwd in the plugin page can you confirm me that the new 'security question' field is the pin code created in the phone app ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/FilipDem/Domoticz-BMW-plugin/issues/5#issuecomment-908329394, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3SGC3XR6AWHCMTAXWPQADT7N7LXANCNFSM5BVOOFVA . 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.

FilipDem commented 3 years ago

Could you confirm me that the restart helped? Or are there still problems? You should have attached the error log from Domoticz... with the line of code where it stopped... This would then be easy to know what was the exact reason... Filip

tsrz commented 3 years ago

sorry, i can only check tomorrow, not at home now

tsrz commented 3 years ago

i restart domoticz and finally reboot my rasperry pi but without success this is the log when i enable the plugin :

2021-08-31 18:15:27.777 Status: Mini: (Mini) Entering work loop. 2021-08-31 18:15:27.777 Status: Mini: (Mini) Started. 2021-08-31 18:15:28.133 Mini: (Mini) Debug logging mask set to: PYTHON 2021-08-31 18:15:28.136 Mini: (Mini) Update Mini SE - Compteur kilométrique: 9970 - 9970 2021-08-31 18:15:28.138 Mini: (Mini) Update Mini SE - Portes: 0 - 0 2021-08-31 18:15:28.141 Mini: (Mini) Update Mini SE - Fenêtres: 1 - 0 2021-08-31 18:15:28.143 Mini: (Mini) Update Mini - Remain mileage (fuel): 0 - 0 2021-08-31 18:15:28.148 Mini: (Mini) Update Mini - Autonomie restante mode Mid: 58 - 58 2021-08-31 18:15:28.149 Notification sent (email) => Success 2021-08-31 18:15:28.152 Kodi Notification (192.168.1.44:9777, TTL 5): Mini SE - Status de la charge, Mini SE n'est plus en charge, Icon /home/pi/domoticz/www/images/logo.png 2021-08-31 18:15:28.152 Notification sent (kodi) => Success 2021-08-31 18:15:28.157 Mini: (Mini) Update Mini SE - Status de la charge: 0 - 0 2021-08-31 18:15:28.161 Mini: (Mini) Update Mini SE - Temps restant avant charge 100%: 1 - 1 2021-08-31 18:15:28.165 Mini: (Mini) Update Mini SE - Niveau de batterie: 36 - 36 2021-08-31 18:15:28.173 Mini: (Mini) Update Mini - Remote Services: 0 - 2021-08-31 18:15:28.174 Mini: (Mini) Update Mini - Car: 0 - 0 2021-08-31 18:15:28.126 Status: Mini: (Mini) Initialized version 2.0.0, author 'Filip Demaertelaere' 2021-08-31 18:15:28.149 Status: Notification: Mini SE n'est plus en charge 2021-08-31 18:15:28.237 Error: Domoticz(pid:1253, tid:32026('Mini')) received fatal signal 6 (Aborted) 2021-08-31 18:15:28.237 Error: siginfo address=0x4e5, address=(nil)

for the security question, no possiblily to enter nothing otherwise the plugin config is not validated, i have a message that this field is required

Fred

FilipDem commented 3 years ago

OK, the problem with the security question is indeed my fault as it is set as "mandatory". Will change it afterwards to make it optional for the future. You can temporary give whatever you want. In the BMW Connected Drive there was a security question and an answer. This was used to be able to open the doors. Seems so far this is not used anymore. However I leave it in case it is used in the future.

For the crash, this is indeed very annoying. As it is really a crash... I don't have this at my side. So it will be difficult to debug. To have some directions:

Just an additional remark: even I have not any crash at my side, I noticed not having updates anymore after a very while (km are not updated). After a restart of the plugin, it is updated again... So still need to troubleshoot this...

Seems we are not yet there... But happy that I got it more or less working again (the rest will follow). Hopefully BMW does not change too often (as there are no official APIs they don't keep compatibility).

All info is welcome.

Filip

tsrz commented 3 years ago

hi,

sorry for the time to answer i finally found the solution : the security question field was my problem, I had put numbers but the solution was to put a letters now i can put whatever i want in it (even numbers) and it keeps working sorry for wasting your time

Fred

FilipDem commented 3 years ago

Fred, Thanks for the feedback... Anyway I must solve this problem... So your feedback is valuable. Have you seen my message... All works again (even the remote services), but after 1 hour (validity of the credentials/tokens) there is a problem... It does not generate errors, but does not update (and probably the remote service will not be executed neither). I will solve this during the weekend. It should not be too difficult (seen the big step switching to the new authentication method is already working again). So I will certainly post an update this weekend. I mentioned this at the beginning of the readme.

tsrz commented 3 years ago

yes, indeed after an hour it no longer works; i wait for the update have a good day

FilipDem commented 3 years ago

Should be solved now by adding one line of code. Is running since this morning... Mileage correctly updated (after driving). Did you see there is a new device 'Mileage (day)'... This uses a standard device and generates statistics (even per day), equivalent to a electricity or gas device. Thanks for your patience. Let me know if it works so that I can close the topic.

tsrz commented 3 years ago

update complete, thanks for the new mileage device and for your all your work i confirm tomorrow if it's ok (but i have no doubt)

FilipDem commented 3 years ago

Should be OK now.