File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -107,15 +107,17 @@ extension MqttFormExtension on AugmentedForm {
107
107
108
108
/// Gets the MQTT topic for subscribing from this [Form] .
109
109
///
110
- /// Throws an [Exception] if no topic could be retrieved.
110
+ /// If present, this getter uses the dedicated vocabulary term `filter` .
111
+ /// Otherwise, the URI query from the `href` field is being used as a
112
+ /// fallback.
111
113
String get topicFilter {
112
114
final topic = _obtainVocabularyTerm <String >("filter" );
113
115
114
- if (topic = = null ) {
115
- throw MqttBindingException ( "MQTT topic was not defined on form." ) ;
116
+ if (topic ! = null ) {
117
+ return topic;
116
118
}
117
119
118
- return topic ;
120
+ return Uri . decodeComponent (href.query. replaceAll ( "&" , "/" )) ;
119
121
}
120
122
121
123
/// Gets the MQTT `retain` value from this [Form] if present.
You can’t perform that action at this time.
0 commit comments