Programmatically change device name

Posted on
Sun Sep 10, 2017 12:10 pm
vvrangler offline
Posts: 38
Joined: Sep 01, 2014

Programmatically change device name

Hi,

Does anyone know if it is possible to update a device name programmatically via python script?

The reason for this is because I have a limited "display" area for the device state and so I would like to move part of the state information to the device name, such as "SmartMeter: 13952.4" where the value of the meter reading would be updated periodically.

Thanks in advance for any help!

Rick

Posted on
Sun Sep 10, 2017 1:09 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Programmatically change device name

this will add a ":123" to the end of device with id = 444736571
Code: Select all
dev = indigo.devices[444736571]
dev.name += ":123"
dev.replaceOnServer()



{ADDED}
and
Code: Select all
dev = indigo.devices[444736571]
name = dev.name.split(":")
dev.name = name[0]+":12345"
dev.replaceOnServer()

will replace ":nnnn" with ":12345"

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests

cron