@@ -49,6 +49,7 @@ Property::Property()
4949, _lightPayload{false }
5050, _update_requested{false }
5151, _encode_timestamp{false }
52+ , _echo_requested{false }
5253, _timestamp{0 }
5354{
5455
@@ -115,6 +116,10 @@ bool Property::shouldBeUpdated() {
115116 return true ;
116117 }
117118
119+ if (_echo_requested) {
120+ return true ;
121+ }
122+
118123 if (_update_policy == UpdatePolicy::OnChange) {
119124 return (isDifferentFromCloud () && ((millis () - _last_updated_millis) >= (_min_time_between_updates_millis)));
120125 } else if (_update_policy == UpdatePolicy::TimeInterval) {
@@ -131,6 +136,11 @@ void Property::requestUpdate()
131136 _update_requested = true ;
132137}
133138
139+ void Property::provideEcho ()
140+ {
141+ _echo_requested = true ;
142+ }
143+
134144void Property::appendCompleted ()
135145{
136146 if (_has_been_appended_but_not_sended) {
@@ -142,7 +152,7 @@ void Property::execCallbackOnChange() {
142152 if (_update_callback_func != nullptr ) {
143153 _update_callback_func ();
144154 }
145- if (! isDifferentFromCloud ()) {
155+ if (isDifferentFromCloud ()) {
146156 _has_been_modified_in_callback = true ;
147157 }
148158}
@@ -161,6 +171,7 @@ CborError Property::append(CborEncoder *encoder, bool lightPayload) {
161171 _has_been_updated_once = true ;
162172 _has_been_modified_in_callback = false ;
163173 _update_requested = false ;
174+ _echo_requested = false ;
164175 _has_been_appended_but_not_sended = true ;
165176 _last_updated_millis = millis ();
166177 return CborNoError;
0 commit comments