]> git.basschouten.com Git - openhab-addons.git/commit
[mqtt.homie] handle exceptions parsing attributes (#12254)
authorCody Cutrer <cody@cutrer.us>
Wed, 23 Feb 2022 12:38:00 +0000 (05:38 -0700)
committerGitHub <noreply@github.com>
Wed, 23 Feb 2022 12:38:00 +0000 (13:38 +0100)
commit923fb12b7d8cf2e8194d25109887f8958afa79b8
tree2af0452c5109f57d64b51368c7b4a08f90f5a263
parent957b69277d358a50ad290fb91a7af391023ad20e
[mqtt.homie] handle exceptions parsing attributes (#12254)

fixes #10711

technically this code is in mqtt.generic, but it's only used by Homie.

in particular, if an incoming string doesn't match an enum, this will now
just ignore the value instead of raising an exception to be caught somewhere inside
of Hive MQTT, and eventually timing out and logging that mandatory topics weren't
received, instead of logging a pointer to the actual problem. this makes it so that
if there's a homie $datatype openhab doesn't understand (like duration), it will be
able to get to the point of just choosing a string channel

also did some minor debug logging cleanup for mqtt:
 * fixed a typo
 * when logging homie device name from the thing handler, use the config deviceid,
   since we likely don't have the attributes from MQTT yet

Signed-off-by: Cody Cutrer <cody@cutrer.us>
bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/ChannelState.java
bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/mapping/SubscribeFieldToMQTTtopic.java
bundles/org.openhab.binding.mqtt.generic/src/test/java/org/openhab/binding/mqtt/generic/mapping/MqttTopicClassMapperTests.java
bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/handler/HomieThingHandler.java