rePublish device state on rename (#4620)

* Republish device state on rename

* Update bridge.js

* Update bridge.js

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
This commit is contained in:
John Doe
2020-10-09 22:59:10 +02:00
committed by GitHub
co-authored by Koen Kanters
parent 9dc34c421f
commit da91158f94
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -327,6 +327,9 @@ class Bridge extends Extension {
this.eventBus.emit(`groupRenamed`, {group: entity.group, homeAssisantRename});
}
// Repulish entity state
this.publishEntityState(to, {});
return utils.getResponse(
message,
{from: entity.settings.friendlyName, to, homeassistant_rename: homeAssisantRename},
+1
View File
@@ -410,6 +410,7 @@ describe('Bridge', () => {
expect(settings.getDevice('bulb_new_name')).toStrictEqual({"ID": "0x000b57fffec6a5b2", "friendly_name": "bulb_new_name", "friendlyName": "bulb_new_name", "retain": true});
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/bulb', '', {retain: true, qos: 0}, expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/bridge/devices', expect.any(String), expect.any(Object), expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith('zigbee2mqtt/bulb_new_name', stringify({"brightness":50,"color_temp":370,"linkquality":99,"state":"ON"}), expect.any(Object), expect.any(Function));
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bridge/response/device/rename',
stringify({"data":{"from":"bulb","to":"bulb_new_name","homeassistant_rename":false},"status":"ok"}),