mirror of
https://github.com/mtan93/homebridge.git
synced 2026-05-08 14:26:04 +01:00
handle missing friendly name
This commit is contained in:
@@ -97,7 +97,11 @@ function HomeAssistantAccessory(log, data, client) {
|
|||||||
// device info
|
// device info
|
||||||
this.data = data
|
this.data = data
|
||||||
this.entity_id = data.entity_id
|
this.entity_id = data.entity_id
|
||||||
this.name = data.attributes.friendly_name
|
if (data.attributes && data.attributes.friendly_name) {
|
||||||
|
this.name = data.attributes.friendly_name
|
||||||
|
}else{
|
||||||
|
this.name = data.entity_id.split('.').pop().replace(/_/g, ' ')
|
||||||
|
}
|
||||||
|
|
||||||
this.client = client
|
this.client = client
|
||||||
this.log = log;
|
this.log = log;
|
||||||
|
|||||||
Reference in New Issue
Block a user