Luligu / matterbridge-shelly

Matterbridge shelly plugin
Apache License 2.0
52 stars 0 forks source link

[FEATURE-REQUEST] Device name suffix #91

Open IvoGruber opened 5 days ago

IvoGruber commented 5 days ago

Hi,

to reduce my pain, when recommissioning the bridge with Alexa, I would love to have a configurable DeviceName-Suffix.

Currently I rename all devices in the Alexa App by adding " Bridge" to it. Thus I can rename the created sub devices (with random names) afterwards with the real name. This is very time consuming and part of the pain after recommisioning.

Would be great if you could add that feature. If you do not have time to do it but want that feature also, please keep that issue open. I think I understand the code good enough now to add this myself for most device types. Just do not know yet how to enhance the configuration view and will need some time to do it.

Luligu commented 5 days ago

Hi, the option is already available, unless I got your idea wrong. image

But as stated pay attention that changing it will change the uniqueid and so the controllers will see it like a new device.

IvoGruber commented 4 days ago

Unfortunately you got me wrong. I know this options but it is for the device serial number, not the device name (column 4 in the table).

So for example changing line 492 in platform.ts from device.name, to device.name + (this.namePostfix ? this.namePostfix : ''), is what I need, where "this.namePostfix" comes from a new configuration option.

Luligu commented 3 days ago

Ok I get it.

1) try to explain me why you need it... maybe I can figure out other strategies. 2) changing the device name has a tons of collateral issues in the whole code so not manageable.

IvoGruber commented 1 day ago

Okay, let me try again to explain why, with some additional context. The only reason to use the matterbridge plugin is to bind it to alexa and be able to use voice commands.

The plugin takes the names as defined in the webapp of the device. So far so good but bad with alexa. Alexa now uses the name as given by the bridge to create a composed device with that name and some subdevices with more or less useless names like "outlet one", "light five" ...

These are the devices, that you usually want to use in a voice command. You don't want to say "Alexa turn on light five" but "Alexa turn on Spock" (lets say "Spock" was the name in the shelly device webapp).

But the name "Spock" is currently used be the useless composed device in alexa, and alexa will respond with "Spock can't do that".

So what I currently do is to rename it to "Spock Bridge" and rename "light five" to "Spock". This must be done with all devices after each recommissioning.

To avoid at least renaming "Spock" to "Spock Bridge" that suffix would help at least for the first part.

Does this help to understand the issue?

IvoGruber commented 1 day ago

Can you explain how this suffix affects the code?

My naive thinking is to just scan for all lines with createDefaultBridgedDeviceBasicInformationClusterServer and do the above renaming using the the postfix.

Another approach is to let each shelly device have that name when created. In this case I can even see no side effects, even if the device name is used somewhere else to lookup or update the device?

I just learned how the plugin-config stuff works now and think I could even do that part now.

Luligu commented 9 hours ago

Ok, I understand your point about naming in Alexa that are not the best user friendly feature of Alexa.

I will think about your idea to add a postfix on the name too.