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 @@ -111,15 +111,17 @@ extension MqttFormExtension on Form {
111111
112112 /// Gets the MQTT topic for subscribing from this [Form] .
113113 ///
114- /// Throws an [Exception] if no topic could be retrieved.
114+ /// If present, this getter uses the dedicated vocabulary term `filter` .
115+ /// Otherwise, the URI query from the `href` field is being used as a
116+ /// fallback.
115117 String get topicFilter {
116118 final topic = _obtainVocabularyTerm <String >('filter' );
117119
118- if (topic = = null ) {
119- throw MqttBindingException ( 'MQTT topic was not defined on form.' ) ;
120+ if (topic ! = null ) {
121+ return topic;
120122 }
121123
122- return topic ;
124+ return Uri . decodeComponent (href.query. replaceAll ( '&' , '/' )) ;
123125 }
124126
125127 /// Gets the MQTT `retain` value from this [Form] if present.
You can’t perform that action at this time.
0 commit comments