-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mqtt.homeassistant] Discovery exceptions processing #11315
Conversation
…omponents discovery Signed-off-by: Anton Kharuzhy <publicantroids@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
You are quite active on the mqtt.homeassistant binding. If you want to, you could add yourself as the codeowner in the CODEOWNERS
file.
@davidgraeff doesn't seem to be active anymore.
…omponents discovery (openhab#11315) Signed-off-by: Anton Kharuzhy <publicantroids@gmail.com> Signed-off-by: Dave J Schoepel <dave@theschoepels.com>
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/broken-homeassistant-mqtt-discovery/125102/15 |
…omponents discovery (openhab#11315) Signed-off-by: Anton Kharuzhy <publicantroids@gmail.com> Signed-off-by: Nick Waterton <n.waterton@outlook.com>
…omponents discovery (openhab#11315) Signed-off-by: Anton Kharuzhy <publicantroids@gmail.com>
…omponents discovery (openhab#11315) Signed-off-by: Anton Kharuzhy <publicantroids@gmail.com>
…omponents discovery (openhab#11315) Signed-off-by: Anton Kharuzhy <publicantroids@gmail.com>
[mqtt.homeassistant] Discovery exceptions processing
Noticed that exceptions in mqtt message handlers are not processed properly during discovery and even not added to logs.
Mqtt transport implementation doesn't have an information about how to process exceptions, and not handling them.
org.openhab.core.io.transport.mqtt.MqttMessageSubscriber#processMessage
Added exceptions types for component config errors and added exceptions processing to mqtt handlers.
I think the bug could be closed after PR: #11085
Can be reproduced by sending invalid JSON to homeassistant discovery */config topic, for example:
mosquitto_pub -h 127.0.0.1 -p 1883 -t homeassistant/sensor/R5EE70BB9_N321346B4/config -m '{"~":"Bedroom/BME280","dev_cla":"temperature","name":"Bedroom Temperature","stat_t":"~state","unit_of_meas":"°C","json_attributes_topic":"~state","val_tpl":"{{ value_json.temperature }}","uniq_id":"R5EE70BB9_N321346B4","avty_t":"~status","pl_avail":"Online","pl_not_avail":"Offline","device":{"identifiers":["R5EE70BB9"],"connections":["mac","00155D009500"],"name":"BME280 Bedroom"}}'
Before PR there are no messages in the log.
After PR:
15:03:24.623 [WARN ] [rnal.discovery.HomeAssistantDiscovery] - HomeAssistant discover error: Cannot parse JSON array. Each connection must be defined as array with two elements: connection_type, connection identifier. For example: "connections": [["mac", "02:5b:26:a8:dc:12"]]