sleevezipper / hass-workstation-service

Provide useful sensors and services from your workstation to Home Assistant.
Apache License 2.0
613 stars 54 forks source link

Using Prefix: Friendly Name & Entity ID don't match #131

Open dsellers1 opened 2 years ago

dsellers1 commented 2 years ago

In HassWS, I set a prefix of "desktop_". Entity_IDs show correctly but the friendly name has a hyphen (-) between the prefix and the sensor name.

For example, in Home Assistant I see: Name = desktop_-CPULoad Entity ID = sensor.desktop_cpuload J7vokkp 1

SecretiveShell commented 2 years ago

This should be an easy fix. I will take a look.

SecretiveShell commented 2 years ago

It's because of this issue. Hass.io does not support - characters in entity names.

dsellers1 commented 2 years ago

It's because of this issue. Hass.io does not support - characters in entity names.

That's the problem. The hyphen isn't supposed to be there. HassWS is setting the friendly name to include the hyphen.

In my example posted above, the prefix was set as "desktop_" (which after some experimentation "desktop" would accomplish the same since it looks like HassWS appends an underscore automatically if there isn't one).

The information from the link is talking about the Entity ID's name, not the friendly name. Entity IDs can only have lowercase letters, numbers, and underscores. The friendly name is more flexible and can include spaces.

Even hovering over the What's This? shows the name with a hyphen and entity ID with an underscore. They don't match. In theory, the name could simply replace the hyphen with a space. OlKPlPF 1

SecretiveShell commented 2 years ago

can you please confirm that you are expecting the attributes to be :

entity Name : desktop ActiveWindowSensor entity ID : sensor.desktop_activewindow

dsellers1 commented 2 years ago

correct. bonus points if you can make the first letter of the entity name capitalized.

entity Name : Desktop ActiveWindowSensor entity ID : sensor.desktop_activewindowsensor