gysmo38 / domoticz-python-melcloud

A plugin in python for Domoticz
11 stars 15 forks source link

Language setting #30

Open janpep opened 2 years ago

janpep commented 2 years ago

Thanks for the update of this plugin. (I was still on 0.7.3, having issues to do settings from Domoticz). Now used the plugin.py from #27 I use it in combination with the temperature from EVOhome plugin,

I found out that using the plugin changed the language from Dutch to English in the MELcloud app. This can be solved by adding the wanted language=12 (for Dutch) to the login arguments like this:

def melcloud_login(self): data = "AppVersion=1.9.3.0&Language=12&Email={0}&Password={1}".format(Parameters["Username"], Parameters["Password"]) self.melcloud_send_data(self.melcloud_urls["login"], data, "LOGIN") return True

May be it can be included?

For completeness here a list with Language codes that I have found earlier. Language codes: 0 = en English 1 = bg Български 2 = cs Čeština 3 = da Dansk 4 = de Deutsch 5 = et Eesti 6 = es Español 7 = fr Français 8 = hy Հայերեն 9 = lv Latviešu 10 = lt Lietuvių 11 = hu Magyar 12 = nl Nederlands 13 = no Norwegian 14 = pl Polski 15 = pt Português 16 = ru Русский 17 = fi Suomi 18 = sv Svenska 19 = it Italiano 20 = uk Українська 21 = tr Türkçe 22 = el Ελληνικά 23 = hr Hrvatski 24 = ro Română 25 = sl Slovenščina

Best regards Jan Peppink, https://ict.peppink.nl

WouterNordsiek commented 1 year ago

To bad, this workaround is not working for me. Are you sure its working with your code from above?

janpep commented 1 year ago

Positive! I am very sure. I have just tested again to be very sure that this code changes the language used for this user.

  1. Verified and confirm current language used in MELCloud App is Dutch and closed the MELCloud app.
  2. Changed plugin.py: the 'Language=12' from my example code to 'Language=0' and restarted Domoticz.
  3. Started MELCloud app. Verified and confirm current language used is English and closed the MELCloud app.
  4. Changed plugin.py: the 'Language=0' back to 'Language=12' and restarted Domoticz.
  5. Started MELCloud app. Verified and confirm current language used in the app is Dutch.

BTW. Not tested now, but from my earlier experience, I guess that when the language is not set here, it defaults to English. This because I discovered the language had changed from Dutch to English when I started to use the plugin without this language setting..

omuskyo commented 1 year ago

Ohh ! I did not understand why the language changed on MELCloud App ! This is the reason !

So in plugin.py (I'm using #27 too), find :

def melcloud_login(self): #data = "AppVersion=1.9.3.0&Email={0}&Password={1}".format(Parameters["Username"], Parameters["Password"]) post_fields = "Appversion:'{0}',CaptchaResponse:{1},Email:'{2}',Language:{3},Password:'{4}',Persist:{5}" post_fields = post_fields.format(str("1.23.4.0"), "null",str(Parameters["Username"]),"1", str(Parameters["Password"]), "true") self.melcloud_send_data_json(self.melcloud_urls["login"], "{"+post_fields+"}", "LOGIN") return True

On second post_fields line, I changed fourth value from "1" to "7" (french language), and now it's OK.

Thanks a lot

janpep commented 1 year ago

I am still using Version: 0.7.7 where the melcloud_login is defined as in my first post. I will look to the updated version to. Thanks.

WouterNordsiek commented 1 year ago

Ohh ! I did not understand why the language changed on MELCloud App ! This is the reason !

So in plugin.py (I'm using #27 too), find :

def melcloud_login(self): #data = "AppVersion=1.9.3.0&Email={0}&Password={1}".format(Parameters["Username"], Parameters["Password"]) post_fields = "Appversion:'{0}',CaptchaResponse:{1},Email:'{2}',Language:{3},Password:'{4}',Persist:{5}" post_fields = post_fields.format(str("1.23.4.0"), "null",str(Parameters["Username"]),"1", str(Parameters["Password"]), "true") self.melcloud_send_data_json(self.melcloud_urls["login"], "{"+post_fields+"}", "LOGIN") return True

On second post_fields line, I changed fourth value from "1" to "7" (french language), and now it's OK.

Thanks a lot

Thank You!! Now its working with the latest version 0.7.9 Gysmo, 2017 Updated by nonolk 2022.

post_fields = post_fields.format(str("1.23.4.0"), "null",str(Parameters["Username"]),"1",

Replacing "1" (at the end of the line) with "12" (Dutch) did the trick!!

Thanks again!!

janpep commented 1 year ago

On the main Code <> page it is still:

I will stick to that version for now, because it is working well for me, with my language edit.