Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/data/mqtt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface MQTTEntityDebugInfo {
entity_id: string;
discovery_data: MQTTDiscoveryDebugInfo;
subscriptions: MQTTTopicDebugInfo[];
transmitted: MQTTTopicDebugInfo[];
}

export interface MQTTTriggerDebugInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class DialogMQTTDeviceDebugInfo extends LitElement {
<code>${topic.topic}</code>
<mqtt-messages
.hass=${this.hass}
direction="Received"
.messages=${topic.messages}
.showDeserialized=${this._showDeserialized}
.showAsYaml=${this._showAsYaml}
Expand All @@ -174,7 +175,31 @@ class DialogMQTTDeviceDebugInfo extends LitElement {
topic.messages.length
)}
>
</mqtt-messages>
</mqtt-rx-messages>
</li>
`
)}
</ul>
Transmitted messages:
<ul>
${entity.transmitted.map(
(topic) => html`
<li>
<code>${topic.topic}</code>
<mqtt-messages
.hass=${this.hass}
direction="Transmitted"
.messages=${topic.messages}
.showDeserialized=${this._showDeserialized}
.showAsYaml=${this._showAsYaml}
.subscribedTopic=${topic.topic}
.summary=${this.hass!.localize(
"ui.dialogs.mqtt_device_debug_info.recent_tx_messages",
"n",
topic.messages.length
)}
>
</mqtt-tx-messages>
</li>
`
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class MQTTMessages extends LitElement {

@property() public messages!: MQTTMessage[];

@property() public direction!: string;

@property() public showAsYaml = false;

@property() public showDeserialized = false;
Expand Down Expand Up @@ -50,7 +52,7 @@ class MQTTMessages extends LitElement {
(message) => html`
<li class="message">
<div class="time">
Received
${this.direction}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could have kept it 1 element and add a direction property to it 😄

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed :)

${formatTimeWithSeconds(
new Date(message.time),
this.hass.locale
Expand Down
1 change: 1 addition & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@
"no_triggers": "No triggers",
"payload_display": "Payload display",
"recent_messages": "{n} most recently received message(s)",
"recent_tx_messages": "{n} most recently transmitted message(s)",
"show_as_yaml": "Show as YAML",
"triggers": "Triggers"
}
Expand Down