Skip to content

Commit

Permalink
Reformat entity name to not include device name
Browse files Browse the repository at this point in the history
  • Loading branch information
awilliams committed Oct 22, 2023
1 parent 33b07e7 commit d2177ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/hass/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type DeviceTracker struct {
Device Device `json:"device,omitempty"` // Information about the device this device tracker is a part of that ties it into the device registry. At least one of identifiers or connections must be present to identify the device.
Icon string `json:"icon,omitempty"` // Icon for the entity. https://materialdesignicons.com
JSONAttributesTopic string `json:"json_attributes_topic,omitempty"` // The MQTT topic subscribed to receive a JSON dictionary payload and then set as device_tracker attributes. Usage example can be found in MQTT sensor documentation.
Name string `json:"name,omitempty"` // The name of the MQTT device_tracker.
ObjectID string `json:"object_id,omitempty"` // Used instead of name for automatic generation of entity_id.
PayloadAvailable string `json:"payload_available,omitempty"` // Default: online. The payload that represents the available state.
PayloadHome string `json:"payload_home,omitempty"` // Default: home. The payload value that represents the ‘home’ state for the device.
Expand Down
1 change: 1 addition & 0 deletions internal/hass/mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ func (m *MQTT) RegisterDeviceTracker(ctx context.Context, dsc Discovery) error {
},
Icon: icon,
JSONAttributesTopic: m.topics.DeviceJSONAttrs(dsc.MAC),
Name: fmt.Sprintf("%s %s", dsc.MAC, m.apName), // This cannot start with 'dsc.Name'
ObjectID: deviceID,
PayloadAvailable: StatusOnline,
PayloadNotAvailable: StatusOffline,
Expand Down

0 comments on commit d2177ca

Please sign in to comment.