From d1061fc614c6c887e3800dd0724eac9dcf60eb49 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 9 Dec 2025 18:32:35 +1100 Subject: [PATCH] ObservableResource: Copy updated_state() response for each observation. Otherwise the same object has its Message ID and (possibly) remote values changed each time it is sent, and the messagemanager can end up out of sync. Also avoids "WARNING Message ID set on to-be-sent message, this is probably unintended; clearing it." if there is more than one recipient. Closes #401 --- aiocoap/resource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiocoap/resource.py b/aiocoap/resource.py index 25a19689..ee9080c8 100644 --- a/aiocoap/resource.py +++ b/aiocoap/resource.py @@ -174,7 +174,7 @@ def updated_state(self, response=None): should be sent to observers.""" for o in self._observations: - o.trigger(response) + o.trigger(response.copy() if response else response) def get_link_description(self): link = super(ObservableResource, self).get_link_description()