Read widget label in hw

@Dmitriy, it is possible to get widget label value in hw side? or in api?

if yes, can you please give an example?

thanks!

@wanek - no. Why would you need widget label :slight_smile:?

hm. a bit complicated to explain. but i will try:

i have to set up 15~20 esp devices in the same project. each device will be installed in a different room, in the same building. to optimise code development and future maintanence, i would like to use the same code on all devices (just with different token).

because i can’t foresee in what room will be each device installed (and anyway didn’t want to hardcode that), in the default code i give for each device a default name, like: room1, room2, room3, etc.

after mounting the devices, the end user should be able to define custom names for each device (preferably from the app), like: kitchen, garage, bedroom, etc.

also, the devices should send notifications to the app, like “motion detected in kitchen” or “door opened in garage”. first i tried to do this without hardcoding the message in hw, using the eventor widget. but it turns out, does not support multiple devices.

then, i thought to edit the name of devices sending a command for each device with terminal widget, like: “room1 name: kitchen”, etc and store that name in eeprom + also update automatically all the appropriate widget labels for the respective room in the app. but terminal is not possible to use with multiple devices…

so, i thought that if i could do the reverse: the user defines a single label for a widget / room in the app, than the hw reads that name, stores it in eeprom, and automatically updates all the related widgets to the same name in the app.

the idea would be that the user could change the name of the device both in hw and app from a single place (ideally in the app). should not have to edit multiple widget labels (because every room will have 4-5 widgets) and will be 20 rooms…

i can not explain very well, but hope it makes any sense…

I see. Thanks for the explanation.

Device renaming is available in published apps only.