Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle UTF-8 in names configured in Wiser Hub #396

Closed
michalfita opened this issue Nov 6, 2023 · 10 comments
Closed

Handle UTF-8 in names configured in Wiser Hub #396

michalfita opened this issue Nov 6, 2023 · 10 comments

Comments

@michalfita
Copy link

I have my rooms in the Wiser App configured with Polish national characters, like "Łazienka" (Bathroom), "Przedpokój" (Landing), "Łazienka Podłoga" (Bathroom Floor) and "Laury Pokój" (Laura's Room), which are perfectly fine displayed in the App.

The Home Assistant integration ignores these characters, showing limp names ("Przedpokj", "azienka", "azienka podoga", etc.):

Zrzut ekranu z 2023-11-06 12-04-42 Anon

Can you please fix deserialisation of these names to take national characters into account?

@msp1974
Copy link
Collaborator

msp1974 commented Nov 6, 2023

Can you provide a diagnostics download from the integration. I didn't think we were doing anything to change this so need to have a look what your hub is providing. Thanks

@michalfita
Copy link
Author

In the diagnostics file names are stripped from national characters as well:
config_entry-wiser-119d7227ca2b1208ec5d50147bdfd2a1.json.txt

@msp1974
Copy link
Collaborator

msp1974 commented Nov 7, 2023

OK, I know what the issue is here. We have some code to fix an invalid char sometimes coming from the hub which is stripping all non-ASCII chars. Will need to look at another way to do this.

@michalfita
Copy link
Author

As far as I remember stray characters appeared only at the end of the output, not in field names. You need to UTF-8 checks as ones available in Rust 😉

@msp1974
Copy link
Collaborator

msp1974 commented Nov 8, 2023

No they appeared in the network parameters too. Its OK, I can fix.

If you want to give it a go before release, you can amend the aiowiserheatapi library in your HA setup and change the following:

In rest_controller.py line 125 where is says:

response = re.sub(rb"[^\x20-\x7F]+", b"", content)

Change to:

response = content.decode("utf-8", "ignore").encode("utf-8")

This will be in next release but that maybe a week or 2 as working on support for v2 hub and want to push all this at same time.

@michalfita
Copy link
Author

I'll check this tomorrow as I don't have time today to dig through the installation. Thanks for quick response.

Do I need to remove the integration and set it up again for this to pick up right names, or is this going to be synchronised as a change in the model?

@msp1974
Copy link
Collaborator

msp1974 commented Nov 8, 2023

It will likely create new room devices and entities with the 'new' names. As such, you can either delete integration and re-add or delete the unavailable entities and old devices once new ones are created.

@michalfita
Copy link
Author

OK, managed to go through this. Seem to be working.
I find Home Assistant's UX unintuitive - removal of devices is in the triple dot menu next to the name, but assignment under pencil button in the far upper right corner (I have a big screen).

I know it's little off topic, but there's no Discussion section in this repo: where the term Wiser LTS comes from? Sounds very alien to me (if you check my LinkedIn profile you may understand why I'm asking).

@msp1974
Copy link
Collaborator

msp1974 commented Nov 8, 2023

It stands for long term statistics. They were created like this some time ago when LTSs were new. The names dont really make sense now but dont want to change them as people will have a lot of history stored for them.

So you used to work on the Wiser product?

@msp1974 msp1974 mentioned this issue Dec 7, 2023
@msp1974
Copy link
Collaborator

msp1974 commented Dec 11, 2023

This was fixed in v3.4.0. Closing issue. Thanks for raising.

@msp1974 msp1974 closed this as completed Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants