Need help NodeRed and Shelly Button 1 issue

hi i googled and got some info to get the Shelly Button 1 to read
i can get it to work if i use in node red

{
    "device": "shellybutton1-485519F2EB03"
}

but i have a few buttons… and if i rename buttons to say
button_1 button_2 button_3 in the Button itself and re add it to HA it still comes up as shellybutton1-485519F2EB03 but button_1 but in HA it shows up at button_1
but if i change

{
    "device": "button_1"
}

NodeRed cant read it… but HA can read it… how can i get it to read the new name not the orginal device name but the one i named it

and my json code is

$outputData("eventData").event.click_type

It’s not clear how you are trying to use this, export the flow where you are using these settings.

[{"id":"8ba05ea79810b838","type":"server-events","z":"e8bbe01d7860c5ec","name":"Shelly Button Around Moms Neck","server":"915baa48.9b1898","version":3,"exposeAsEntityConfig":"","eventType":"shelly.click","eventData":"{\"device\":\"shellybutton1-485519F2EB03\"}","waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"$outputData(\"eventData\").event.click_type","valueType":"jsonata"}],"x":130,"y":920,"wires":[[]]},{"id":"8b80609380dc2162","type":"server-events","z":"e8bbe01d7860c5ec","name":"Shelly Button Around Moms Neck","server":"915baa48.9b1898","version":3,"exposeAsEntityConfig":"","eventType":"shelly.click","eventData":"{\"device\":\"Shelly_Button_2\"}","waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"$outputData(\"eventData\").event.click_type","valueType":"jsonata"}],"x":130,"y":980,"wires":[[]]},{"id":"915baa48.9b1898","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

i think i did it right… button name changed from the orginal post only cuz i been trying and labeling as i got 4 buttons

so only
shellybutton1-485519F2EB03 this works
and
shelly_button_1 doesnt work
even though shelly_button_1 is the device name in HA and in the Shelly Device

Have you tried this using a device node? Or an event state instead of events all. The device should let you pick the trigger. With the event state assign the device and nothing else then after use a change node to split the different events.

i dont know how to use any of it… the above i found from a google post and where someone asked and they said this was the easiest. but it was how ever they figured it out but when u rename things it doesnt works so u get confused with the serial number especially if you got mulitple buttons

and i dont know how you do that. is that per button or something

and i was going to try the mqtt route i set it up in the button but it doesnt show up in the mqtt in HA so something wrong there… tried latest firmware and beta neither worked… so been trying different ways and i guess i have 5 buttons i had just ordered 4 more came yesterday but i had 1 already so i wanna disgtinus between 5 buttons easier then the serial number

Just to understand correctly with the event all, your flow, when configured with the old device name works?

Set the output to event data to capture the whole event in a debug. Look through the output for the name you gave the device.

image

How did you rename the devices? In HA gui or through the shelly web interface?
It looks like you need to rename them through shelly.

https://www.home-assistant.io/integrations/shelly/#entity-naming-generation-1

so i cant used a device node… it only has a Battery entity… probably as the button shuts off after you press it…

say when you change the button name in Shelly Button change Device name and Channel name to Shelly Button 1
and reboot HA… it shows up as
shellybutton1-485519F2EB03
but when you add the device… it adds the device as Shelly Button 1

and for your event data this is what i got

but if i do it for shelly button 2 thats labeled in HA devices i get nothing yet it shows up in HA logs
shell

i did try changing this button to Shelly Button 2 as i had 1 before it… but didnt matter ive tried like shelly button 2 Shelly Button 2 shelly_button_2 like those type of combination no matter what node red only captures the serial number one not the HA device name

maybe i cant do it? and i just have to do it 1 button at a time ?

The names were changed in the device itself?

https://www.home-assistant.io/integrations/shelly/#entity-naming-generation-1

Names are set from the device web page:

  • Device name can be set in Settings >> DEVICE NAME

ya she i was saying here i set the device names in Device its self device name and channel name


im just wondering maybe its bug in there software… that even though you change the channel name and device name its not sending it its still sending the Actual Device Name and Serial number

Did you remove the shelly integration and re add it after the name change?

ya does the same where i mentioned above
if i delete the change the name
delete it from HA
reboot HA
press Button
HA detects button
Finds Shellybutton1-123423423423
when you add it
it adds it as
Shelly Button 2

i did also just email shelly support to say if its a glitch in there OS as MQTT doesnt work for me and changing the device name doesnt work but it does work if i keep the serial number but its going to get confusing after a while

It maybe that the change is only superficial and the name change is handled by HA’s gui. Events all is the raw event feed so you may just need to use the discovered device names.

This is the way that multiple devices are handled with a raw feed.

[{"id":"8ba05ea79810b838","type":"server-events","z":"0a325c35fc29f44e","name":"All shelly clicks","server":"6b1110b5.183a4","version":3,"exposeAsEntityConfig":"","eventType":"shelly.click","eventData":"","waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"}],"x":260,"y":4300,"wires":[["23cd128f34d9e047"]]},{"id":"23cd128f34d9e047","type":"switch","z":"0a325c35fc29f44e","name":"which device","property":"payload.event.device","propertyType":"msg","rules":[{"t":"eq","v":"device 1 #","vt":"str"},{"t":"eq","v":"device 2 #","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":4300,"wires":[["4ce5dafe9fbe2f41"],["aeedd9bd3fa402b9"]]},{"id":"4ce5dafe9fbe2f41","type":"switch","z":"0a325c35fc29f44e","name":"which channel device 1","property":"payload.event.channel","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":4260,"wires":[["1f39d6097684baf4"],[]]},{"id":"aeedd9bd3fa402b9","type":"switch","z":"0a325c35fc29f44e","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":4340,"wires":[[]]},{"id":"1f39d6097684baf4","type":"switch","z":"0a325c35fc29f44e","name":"button press type","property":"payload.event.click_type","propertyType":"msg","rules":[{"t":"eq","v":"single","vt":"str"},{"t":"eq","v":"double","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":970,"y":4240,"wires":[[],[]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"id","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

Although mqtt not working does indicate there is a problem with the shelly firmware, perhaps it can be reflashed/ updated.

this work around works… just gotta make sure everything on the page… i tested 2 buttons and it splits that
or i do 1 and just label box so least it has a name just still has to do it 1 at a time

but its something

but ya the mqtt isnt showing up in the Devices… going to delete MQTT in devices and reboot and re add it to see if it detects shelly

When you select the device in the device node does it show the new name or the discovered name? If it shows the new name, then it is probably because we are seeing the event before ha processes it and changes the name.

when it shows up as discovered devices it shows the
shellybutton1-12312312 not the new button 1 or 2 or 3 so on

but when you click add and then it shows Device name then says Button 1 and thats what gets saved into HA but even then nodred doesnt read the button 1 it only sees the shellybutton1-123234234

and frustrating the mqtt isnt working… i followed a video i googled… and it should have worked but its not lol just to see if mqtt works go figure lol

Oddly enough according to the docs, I believe this is right. The name of the device is hard coded to the shelly. When you rename the device on the shelly, this doesn’t change the hard coded value that it broadcasts. This is why it shows up as deviceabc123

The docs says that it uses the device name/channel name. This name info is sent when the device is first integrated and stored inside ha. The switch you see when you integrate it.

The shelly likely still broadcasts as the hard coded id. We are intercepting this event broadcast before HA processes it and changes it to the stored name.