Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a retain flag supported by mqtt in the gateway and status topi… #237

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LePailleurThibault
Copy link
Contributor

…cs in mqtt.

Some brokers (like AWS iot core) do not support retain messages. Add option to transport to specify if the retain is supported by broker.

New MQTT topics can be used in the case where the mqtt broker does not support retained message and we would like to know the status of the gateways as soon as possible.

The concerned topics in the mqtt broker are :
gw-request/get_gw_status
gw-response/get_gw_status//

Closes # .

Brief pull request description

@@ -60,11 +61,13 @@
file_vars["gateway_version"] = env_vars["WM_GW_VERSION"]
file_vars["ignored_endpoints_filter"] = env_vars["WM_GW_IGNORED_ENDPOINTS_FILTER"]
file_vars["whitened_endpoints_filter"] = env_vars["WM_GW_WHITENED_ENDPOINTS_FILTER"]
file_vars["mqtt_retain_flag_supported"] = env_vars["WM_SERVICES_MQTT_RETAIN_FLAG_SUPPORTED"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Black would make changes.
line too long (92 > 79 characters)

python_transport/wirepas_gateway/protocol/mqtt_wrapper.py Outdated Show resolved Hide resolved
Copy link
Contributor

@pgaucherand pgaucherand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor comment from, otherwise looks good.

python_transport/wirepas_gateway/protocol/mqtt_wrapper.py Outdated Show resolved Hide resolved
…cs in mqtt.

Some brokers (like AWS iot core) do not support retain messages.
Add option to transport to specify if the retain is supported by broker.

New MQTT topics can be used in the case where the mqtt broker does not support retained message
and we would like to know the status of the gateways as soon as possible.

The concerned topics in the mqtt broker are :
gw-request/get_gw_status
gw-response/get_gw_status/<gw-id>/<sink-id>
…tus branch to suppress it and simplify branches) + PR#236
@@ -60,11 +61,13 @@
file_vars["gateway_version"] = env_vars["WM_GW_VERSION"]
file_vars["ignored_endpoints_filter"] = env_vars["WM_GW_IGNORED_ENDPOINTS_FILTER"]
file_vars["whitened_endpoints_filter"] = env_vars["WM_GW_WHITENED_ENDPOINTS_FILTER"]
file_vars["mqtt_retain_flag_not_supported"] = env_vars["WM_SERVICES_MQTT_RETAIN_FLAG_NOT_SUPPORTED"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Black would make changes.
line too long (100 > 79 characters)

@@ -227,6 +291,18 @@ def __init__(self, settings, **kwargs):
else:
self.data_event_id = None

if not self.retain_supported:
logging.info("Gateway status is sent every %d seconds", settings.mqtt_send_gateway_status_period_s)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (111 > 79 characters)


self.mqtt.add_argument(
"--mqtt_send_gateway_status_period_s",
default=os.environ.get("WM_SERVICES_MQTT_SEND_GATEWAY_STATUS_PERIOD_S", 20),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (88 > 79 characters)

@@ -363,6 +363,31 @@ def add_mqtt(self):
),
)

self.mqtt.add_argument(
"--mqtt_retain_flag_not_supported",
default=os.environ.get("WM_SERVICES_MQTT_RETAIN_FLAG_NOT_SUPPORTED", False),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (88 > 79 characters)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants