Assign friendly name for device


#1

1) Give a description of the problem
I have a basic piston that alerts when a door opens or closes. Right now it uses $CurrentEventDevice for the name of the device in the alert. What I would like to do is set a more friendly name. For instance, the name in Smarthings is “Sensor Back door”. When I get the alert I would like it to just say “Back door opened” instead of “Sensor back door opened”. I know I can just rename the device in Smarthings but just trying to figure this out as it may help with future pistons.

2) What is the expected behaviour?
Assign friendly name to device name.

3) What is happening/not happening?
Can’t figure out how to assign a friendly name to the variable.

**4) Post a Green Snapshot of the piston!

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING


#2

You can use the replace() function.

replace($currentEventDevice,“Sensor “,””)

In the case of Sensor Back door, it will just be Back door.


#3

Man I feel silly. I tried everything except using replace. Time for some coffee.

Thanks for the assist.