Page 1 of 1

Request for the use of friendly names in addition to device names

Posted: Monday 18 June 2018 12:36
by rbisschops
Hi All,

In other platforms I see the use of a "device name" and a "friendly name". The device name can be something like: "VirtualSwitchFoo", where the friendly name can be "Foo switch".
This would help using more complex names as the device name for use in scripts, while the dashboard stays readable for the day-to-day users of Domoticz.

Is this something the community would like to see implemented (so we can open a request ticket)?

Pro's and con's are also welcome! Can I have your votes!

Thanks,

Ralph

Re: Request for the use of friendly names in addition to device names

Posted: Monday 18 June 2018 12:52
by snellejellep
in dzvents you can do this by defining this at the top of the execute section:

Code: Select all

local scriptname = domoticz.devices("dashboardname")

Re: Request for the use of friendly names in addition to device names

Posted: Monday 18 June 2018 14:17
by rbisschops
snellejellep wrote:
Monday 18 June 2018 12:52
in dzvents you can do this by defining this at the top of the execute section:

Code: Select all

local scriptname = domoticz.devices("dashboardname")
Good suggestion, thinking out loud this might me something to define as global variables is dzVents for the time beeing, however there is more than dzVents when it comes to scripting, so imho this still might be a viable request.

edit: is this possible (defining at a global level)

Re: Request for the use of friendly names in addition to device names

Posted: Monday 18 June 2018 15:28
by mcwieger
And for use in voice commands, obviously.

Re: Request for the use of friendly names in addition to device names

Posted: Wednesday 20 June 2018 22:31
by rbisschops
snellejellep wrote:
Monday 18 June 2018 12:52
in dzvents you can do this by defining this at the top of the execute section:

Code: Select all

local scriptname = domoticz.devices("dashboardname")
Was overthinking this again. Using local vars is not very helpfull. If you have coded device names like PirLivingroom and PirHalway, you want to use filters or wildcards to select these. That does not work with the local vars. It also isn’t a logical name either. In the frontend you want to see Motion livingroom or somthing like that.

Any thoughts?

Re: Request for the use of friendly names in addition to device names

Posted: Wednesday 20 June 2018 22:47
by DeBaat
The data set of a device now contains the ID to identify a device.

In order to get this suggestion working, we only need to define an additional field (e.g. "slug") and the ability to set and change its value.
Of course there also needs to be some validation when setting and changing the value to ensure that each device has a unique slug.

The next thing would then be to add the "slug" as additional identifying field to the methods selecting a device.

For efficiency, we could define an index on the database for this new field.
And maybe a sorting button to sort the list on this value.

I would also like to suggest to define a slug as to only contain lower case characters, digits and some 'special' characters like '_'.
When entering a value, you could program to force correct input with something like tolower() and replace any non-alphanumeric character to '_'.

Hope this helps.