StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
621 stars 111 forks source link

Rename device #245

Closed palinf closed 4 years ago

palinf commented 4 years ago

I think the feature of renaming devices would be interesting.

Currently I have the following configuration:

shelly:
...
  devices:      #devices to be added
    - id: E098068D993E
      entity_id: et0_cuisine_pushbutton_lampe_canape

Which leads to this output:

Screenshot 2020-04-01 at 16 21 24

It makes the things quite complex for everything linked with device name (automation, logging, storage ...) especially with several number of devices and entities

A configuration like this:

shelly:
...
  devices:      #devices to be added
    - id: E098068D993E
      rename_device: et0_cuisine_pushbutton
      rename_entity: lampe_canape

and maybe for devices with multiple entities:

shelly:
...
  devices:      #devices to be added
    - id: E098068D993E
      rename_device: shelly4pro_mainbreakerbox
      rename_entity_1: ceilling_lights
      rename_entity_2: garden_lights
      rename_entity_3: ...
chemelli74 commented 4 years ago

Use "name" and entities device. Something like:

devices:      #devices to be added
    - id: E098068D993E
      name: shelly4pro_mainbreakerbox
   - id: E098068D993E-1
     name: ceilling_lights
   - id: E098068D993E-2
      name: garden_lights

Simone

palinf commented 4 years ago

@chemelli74 your solutions is only changing friendly name not entity id. Automation, logging, storage are using entity_id or device id.

- id: 062127
  name: shellyem-062127_et0_chambre_tableau
- id: 062127-1
  name: all_conso_generale
- id: 062127-2
  name: et0_conso_remise

Here is the output:

Screenshot 2020-04-02 at 21 25 31

Only friendly name is changed. But the entity_id is not:

Screenshot 2020-04-02 at 21 26 55

By renaming device name it makes the automation, logging, storage ... more convenient.

Right now it is possible to rename entity_id by using:

So I am looking a way to rename the device the same way we can do it for entities. I do not think it exists.

hakana commented 4 years ago

Can't you just rename the device in the HA GUI?

palinf commented 4 years ago

The possibility shellyforhass offered for entity_id renaming is great.

Are you suggesting to rename devices in HA GUI ? See below screenshot ? Then this will lead to two ways of configuring (both in configuration.yaml and inside the .storage/ ... It seems to me it makes the things pretty dirty, especially when you start to have complex configuration.

Here is a summary of what I understand of ShellyForHASS renaming capabilities: Device :

Screenshot 2020-04-03 at 14 33 25
palinf commented 4 years ago

Back on this subject, I would like to have your opinion on the implementation of this feature.

@hakana On another thread I saw that you are working on a configuration GUI:

Right now Im building a configuration GUI for shelly, so I think it is better to do the naming there.

Would this allow to set the unique of the shelly and thus may I ask you when you think this feature will be available ?

Could you also confirm that: https://github.com/StyraHem/ShellyForHASS/blob/7a06ce08068f9b400c0d9530ad99509225ffdbb9/custom_components/shelly/block.py#L21

Is one way to go if I want to patch shellyforhass to have the feature of changing device id ?

chemelli74 commented 4 years ago

Can you please update to 0.1.9b1 and retest ?

Simone

cyberplant commented 4 years ago

Hello!

I started using shelly products recently and I'm using this to connect to HASS and it works great! I used this rename feature and it worked fine except for the RGBW2. On this device, after I restart HASS cannot find it anymore, and I have to remove it and restart HASS to have it back (with the original name). I mean, it works fine after I rename while I don't restart HASS, I can even use it on automations, but when I restart HASS boom.

On the other devices (Shelly 2.5, Shelly Dimmer) I just renamed and everything was still working after HASS restart.

I can provide more debug log if needed.

chemelli74 commented 4 years ago

@cyberplant which version of plugin are you using ?

Simone

cyberplant commented 4 years ago

1.9-b2

hakana commented 4 years ago

Do you see any errors in log?

cyberplant commented 4 years ago

Updated HASS to the latest version and now I cannot reproduce it.. so good news! I restarted HASS couple times and still can see my RGBW after being renamed! Thanks!!

cyberplant commented 4 years ago

Eek, I'm back, this issue again! it was working fine, I've restarted hass several times and all OK, but now I've lost the RGB again: image image

As you can see I have other shelly devices renamed and they work fine. No errors on log..

chemelli74 commented 4 years ago

Is a rename issue or an availability issue ?

Simone

cyberplant commented 4 years ago

You mean if the device is connected? it is, I can reach it with the shelly app without issues. And if I remove the renamed entities and let shelly4hass add them back again, I can control them with HASS once again.

chemelli74 commented 4 years ago

@cyberplant, basically after rename you get a "unavailable" entity with the new name. Right ? But is the old entity present ?

Please describe more in depth starting situation, all steps and then final situation.

Thx,

Simone

chemelli74 commented 4 years ago

Hi all, just to inform that after 3 weeks of inactivity on thread, I'll proceed to close them. If later one someone verify that the issue is still there, a new issue need to be opened.

Thank you,

Simone

chemelli74 commented 4 years ago

No update for 21 days, closing

Simone