Skip to content

MqttBrokerSensor:  grab chart/overlay labels from configured topic names#2906

Open
jerrylewisbh wants to merge 1 commit into
aaronwmorris:mainfrom
jerrylewisbh:mqtt-dynamic-labels
Open

MqttBrokerSensor:  grab chart/overlay labels from configured topic names#2906
jerrylewisbh wants to merge 1 commit into
aaronwmorris:mainfrom
jerrylewisbh:mqtt-dynamic-labels

Conversation

@jerrylewisbh
Copy link
Copy Markdown

@jerrylewisbh jerrylewisbh commented May 7, 2026

Replaces the static Topic 1..10 labels with names derived from the user's configured topics.

Changes                                                                    

  - mqttBrokerSensor.py: new optional classmethod get_dynamic_labels(pin_1_name) — formats the comma-separated topic list, drops trailing /state, pads to 10 with Topic N.                           

  - capture.py: update_sensor_slot_labels() reads *_PIN_1 for slots A–F and uses get_dynamic_labels when the driver class implements it. Falls back  to METADATA['labels'] otherwise.                                            
                                                 

Backward compatatibility                                                            

  No new config keys, no schema changes. Every other driver lacks get_dynamic_labels → existing path unchanged (verified against BME280, INA228, MPU6050, simulator).

Solves: #2905

@aaronwmorris
Copy link
Copy Markdown
Owner

This makes sense. I will take a closer look in a bit.

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