You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MQTT Will Message’s topic MUST be of the form spBv1.0/STATE/sparkplug_host_id where host_id is the unique identifier of the Sparkplug Host Application
Currently in the _mqtt_on_message method of the MqttSpbEntity class you have:
# Check that the namespace and group are correct# NOTE: Should not be because we are subscribed to an specific topic, but good to check.iftopic.namespace!="spBv1.0"ortopic.group_name!=self._spb_group_name:
logger.error("%s - Incorrect MQTT spBv1.0 namespace and topic. Message ignored !"%self._entity_domain)
return# Check if it is a STATE message from the SCADA applicationiftopic.message_type=="STATE":
# Execute the callback function if it is not Noneifself.on_messageisnotNone:
self.on_message(topic, msg.payload.decode("utf-8"))
return
and since the message topic is divided like this:
topic_fields=topic_str.split('/') # Get the topicself.topic=topic_strself.namespace=topic_fields[0]
self.group_name=topic_fields[1]
self.message_type=topic_fields[2]
self.eon_name=Noneself.eon_device_name=None
The on_message callback will never capture state messages because the MqttSpbTopic class assumes the group always comes after the spBv1.0 part of the message topic, which is true for most topics but not true for STATE messages.
The text was updated successfully, but these errors were encountered:
Acording to the Sparkplug B Spec section 5.13:
The MQTT Will Message’s topic MUST be of the form
spBv1.0/STATE/sparkplug_host_id
where host_id is the unique identifier of the Sparkplug Host ApplicationCurrently in the
_mqtt_on_message
method of theMqttSpbEntity
class you have:and since the message topic is divided like this:
The on_message callback will never capture state messages because the
MqttSpbTopic
class assumes thegroup
always comes after thespBv1.0
part of the message topic, which is true for most topics but not true forSTATE
messages.The text was updated successfully, but these errors were encountered: