Hue_activate_scene and special characters

Hi,

I tried to set up an automation that activates a hue scene.
The group_name would contain a special character: “Büro” (= study).
I tried various ways, but I only managed to get the automation to work after replacing the special character in the Hue app.
I tried using “scene_name: Buro” (i.e. replacing “ü” for “u” as HA usually does this - the entity corresponding to this “room” is called “light.buro”).
I also tried using an actual “ü” with UTF-8 file encoding, but at least the configtest tool then complains:

ERROR (Thread-1) [homeassistant.util.yaml] unacceptable character #x009f: special characters are not allowed in [...]

Is this a bug or is there another way to get this to work?

Sebastian

I would stick with english words for entity id’s and use special chars in the friendly names, you will have an easier time.

I usually do, but the name is set within the Hue app and is displayed as the room’s name.
I don’t really want to give English names to “things” that are visible as part of the user interface.
It’s 2017 and not 1997 after all… :wink:

Sebastian

I got it now. It’s apparently some kind of encoding issue:
The “ü” when typed on the keyboard appears as “<9f>” and when read from the hue bridge (/api/…/groups) it shows as “√º”.
I copy&pasted the latter into my automation and now it works.

Damn encodings… :wink:

Sebastian

Can you post the relevant line of your automation? I’d just like to see how to use encodings for those

You don’t have to specifically encode these characters (if you’re thinking along the lines of encoding for special characters in HTML or URLs).
Depending on the involved programs/layers (like editor, shell, terminal) and their settings, the way the character is appearing on your display may differ.

First you need to make sure the configuration (yaml-)file is UTF-8 encoded, i.e.:

# file myautomation.yaml
myautomation.yaml: UTF-8 Unicode text

(you can use iconv to convert a file between different encodings)

And then the character you type must be encoded correctly.
I was editing the yaml file in vim, running inside a ssh session in my Mac’s terminal program and I think the terminal program’s setting was off…

When everything works, the “ü” is encoded as follows:

# grep group_name myautomation.yaml | hexdump -C
00000000  20 20 20 20 67 72 6f 75  70 5f 6e 61 6d 65 3a 20  |    group_name: |
00000010  27 42 c3 bc 72 6f 27 0a                           |'B..ro'.|
                ^^^^^

Sebastian

You could just use SublimeText as your editor, then save the file in UTF-8 format, which is one of the options:

Save with Encoding

:wink:

That would be an option, but I usually use vi(m) and create/edit the file directly on the host.
Now that I’m thinking about it, I also have installed “rmate” which remotely opens a file in TextMate on my Mac.
Well, once you figure out that a wrong encoding is the culprit, there are a lot of possible solutions…

Sebastian