Closed migte closed 3 years ago
Looks good to me, except I think you need to have a name
param. Also, I like to simplify the logic with a ternary operator when it's a simple switch:
name(alias) {
return this.info()
.then(info => {
return typeof info.dev_name !== 'undefined'
? this.send({ system: { set_dev_alias: alias } })
: this.send({ 'smartlife.iot.common.system': { set_dev_alias: alias } })
})
}
Is this resolved in #51 ?
Yes it is, I will close it now then thanks.
Hello again!
I'm not sure whether or not this is in the scope of the project, but I was able to have a function to change the names of the devices. The if and else is due to lightbulbs and other devices working differently.
"system": {"set_dev_alias"{...
has worked on all of my switches and power outlets. I have only tested"smartlife.iot.common.system": { "set_dev_alias" {...
on my LB130's.Here is the lib code:
Is there anything I should cleanup/change? If everything looks alright I can make a PR.