Skip to content

Move name config to be per device for easier management of the config#6

Merged
TheLarsinator merged 2 commits intomainfrom
5-improve-friendly-name-feature
Apr 4, 2026
Merged

Move name config to be per device for easier management of the config#6
TheLarsinator merged 2 commits intomainfrom
5-improve-friendly-name-feature

Conversation

@TheLarsinator
Copy link
Copy Markdown
Owner

Solves #5

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the card configuration schema to make device name overrides live alongside each device’s coordinates, improving manageability for large device lists (Solves #5).

Changes:

  • Rename device_coordinatesdevices and update rendering logic to use the new config key.
  • Move manual label overrides from friendly_names into devices[ieee].name and adjust label priority accordingly.
  • Update documentation/examples and the coordinate picker to emit the new devices: YAML format.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
zigbee-floorplan-card.js Switches config to devices and reads per-device name overrides for labels.
tools/coordinate-picker.html Generates YAML with devices: instead of device_coordinates:.
README.md Updates main docs and examples to the new devices + optional name format.
examples/configuration-example.yaml Replaces device_coordinates with devices in examples.
examples/card-config-example.yaml Updates example config to devices and demonstrates per-device name.
docs/QUICKSTART.md Updates quickstart snippets to use devices.
docs/PROJECT-INFO.md Updates config template to use devices (but still contains stale friendly_names content).
docs/MQTT-SETUP.md Updates snippets to use devices (but still contains stale friendly_names override example).
Comments suppressed due to low confidence (1)

docs/MQTT-SETUP.md:162

  • This section says manual name overrides can be configured via friendly_names, but the implementation no longer supports friendly_names. Update the example to use devices: <ieeeAddr>: { x, y, name } (or remove the override section) to avoid misleading setup instructions.
### Manual Friendly Name Override

You can still override individual device names:

```yaml
type: custom:zigbee-floorplan-card
entity: sensor.zigbee2mqtt_networkmap
image: /local/floorplan.png
devices:
  # ...
friendly_names:
  "0x00124b005678efgh": "My Custom Name"  # Override the Z2M name
</details>



---

💡 <a href="/TheLarsinator/zigbee-floorplan-card/new/main?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.

Comment thread zigbee-floorplan-card.js
Comment on lines 20 to +35
@@ -32,13 +32,12 @@ class ZigbeeFloorplanCard extends HTMLElement {
this._config = {
entity: this._sanitizeString(config.entity),
image: this._sanitizeUrl(config.image),
device_coordinates: config.device_coordinates,
devices: config.devices,
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setConfig now requires config.devices and will throw for existing configurations that still use the documented device_coordinates key from prior versions. To avoid a breaking change (or at least provide a smoother migration), consider accepting device_coordinates as a fallback/alias (and/or emitting a clear deprecation warning) before throwing an error.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can live with that. I will bump the mayor version.

Comment thread docs/PROJECT-INFO.md
Comment on lines 173 to +177
show_link_lqi: false # Show LQI numbers on connections (default: false)
mqtt_base_topic: zigbee2mqtt
friendly_names: # Optional overrides
'0xbc026efffe29c7de': 'Main Coordinator'
device_coordinates:
devices:
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This documentation example still uses friendly_names, but the card code no longer reads friendly_names from config. Update this section to demonstrate per-device overrides via the name field under devices (or remove the friendly_names block) so users don't configure an option that has no effect.

Copilot uses AI. Check for mistakes.
Comment thread zigbee-floorplan-card.js
Comment on lines 32 to 42
this._config = {
entity: this._sanitizeString(config.entity),
image: this._sanitizeUrl(config.image),
device_coordinates: config.device_coordinates,
devices: config.devices,
image_width: imageWidth,
image_height: imageHeight,
circle_radius: circleRadius,
show_labels: config.show_labels !== false,
show_link_lqi: config.show_link_lqi === true,
friendly_names: config.friendly_names || {},
mqtt_base_topic: this._sanitizeString(config.mqtt_base_topic || 'zigbee2mqtt')
};
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes friendly_names support entirely (it is no longer stored on _config and getDeviceLabel no longer checks it). That’s a breaking config change for existing users; consider supporting friendly_names as a deprecated fallback by mapping entries into devices[ieee].name (or, at minimum, detect friendly_names and surface a targeted migration error/warning).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can live with that. I will bump the mayor version.

@TheLarsinator TheLarsinator merged commit 113cb2c into main Apr 4, 2026
2 checks passed
@TheLarsinator TheLarsinator deleted the 5-improve-friendly-name-feature branch April 5, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants