We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e68174d commit 7903641Copy full SHA for 7903641
1 file changed
src/hal/user_comps/mqtt-publisher.py
@@ -84,9 +84,18 @@ def create_pins(self, keys):
84
def update_mqtt(self):
85
"Run the endless loop fetching pin data and sending it to MQTT."
86
running = True
87
+ missing = {}
88
while hal.component_exists('halui') and running:
89
data = {}
90
if self.hal['enable']:
91
+ for key in self.keys:
92
+ try:
93
+ data[key] = hal.get_value(key)
94
+ except RuntimeError as e:
95
+ # Only print warning once
96
+ if key not in missing:
97
+ print(f"warning: Missing pin {key} not sent to MQTT")
98
+ missing[key] = True
99
data['mqtt-publisher.period'] = self.hal['period']
100
if not self.dryrun:
101
print(f"info: Publishing MQTT message ({self.mqtt_prefix}):", json.dumps(data))
0 commit comments