Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new mqtt command to rename devices #177

Closed
lolorc opened this issue Jul 3, 2018 · 6 comments
Closed

new mqtt command to rename devices #177

lolorc opened this issue Jul 3, 2018 · 6 comments
Labels
feature request Feature request

Comments

@lolorc
Copy link
Contributor

lolorc commented Jul 3, 2018

Hi,

I've just started to use your project yesterday, I might be wrong but it looks like we have to restart the daemon when we rename a device.
If this statement is correct, I think it would be useful to be able to change the friendly_name of a device with a mqtt command.

@ciotlosm
Copy link
Contributor

ciotlosm commented Jul 3, 2018

@lolorc if you're using home assistant you could use the unique_id functionality and just rename your devices in Home Assistant directly.

@Koenkk Koenkk added the feature request Feature request label Jul 3, 2018
@Koenkk Koenkk added this to the 0.2 milestone Jul 3, 2018
@tb-killa
Copy link
Contributor

tb-killa commented Jul 3, 2018

@Koenkk Question: Does we could trigger zigbee2mqtt internal to reread the configuration.yaml ?
So we could build mqtt topic for rename who is internal only the friendly_name entry change and trigger the reread of the configuration.yaml.

@lolorc
Copy link
Contributor Author

lolorc commented Jul 4, 2018

@lolorc if you're using home assistant you could use the unique_id functionality and just rename your devices in Home Assistant directly.

Yes I'm using home-assistant but I'm not using the discovery thingy. I guess I should have a look at it.
However I still think it would be useful to be able rename devices and reload config thru mqtt.

@ciotlosm
Copy link
Contributor

ciotlosm commented Jul 4, 2018

@lolorc Agree that feature would be useful, but believe me that using Home Assistant with discovery and unique ID makes renaming and managing devices much easier.

@tb-killa
Copy link
Contributor

tb-killa commented Jul 9, 2018

Implemented rudimental rename function for settings.js

function RenameFriendlyName(original,replace) {
	originalName = getIDByFriendlyName(original)
	if(!originalName) {
		return null;
	}
	removeDevice(originalName)
	if (!settings.devices) {
        settings.devices = {};
    }
	settings.devices[originalName] = {friendly_name: replace, retain: false};
    writeRead();
}

module.exports

RenameFriendlyName: (original,replace) => RenameFriendlyName(original,replace),

Koenkk added a commit that referenced this issue Jul 24, 2018
Rename devices (friendly_name) ->  (#177)
@Koenkk
Copy link
Owner

Koenkk commented Jul 24, 2018

Merged and documented: https://github.com/Koenkk/zigbee2mqtt/wiki/MQTT-topics-and-message-structure#zigbee2mqttbridgeconfigrename

Many thanks for the implementation @tb-killa !

@Koenkk Koenkk closed this as completed Jul 24, 2018
wilmardo pushed a commit to wilmardo/zigbee2mqtt that referenced this issue Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature request
Projects
None yet
Development

No branches or pull requests

4 participants