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

Default Topic MQTT seems broken #10

Open
rekkebus opened this issue Nov 5, 2022 · 2 comments
Open

Default Topic MQTT seems broken #10

rekkebus opened this issue Nov 5, 2022 · 2 comments

Comments

@rekkebus
Copy link

rekkebus commented Nov 5, 2022

Hi there,

Thanks for making a great library on pymadoka and a MQTT broker, trying to get this to work for HVACS.

I noticed 2 things already:

When using root topic starting with a / you get some weird behaviour, at least on mosquito:

Defining a root topic without a trailing / fixes this, although the default ROOT TOPIC in mqtt.py is still defined with a /

Furthermore, my madoka keeps changing names in bluetooth. Half of the time it is called "UE878_RF_MODULE" and the other half "BRC1H_AA_BB-CC" . i changed the mqtt library to accept a config value "root_topic_only" that omits the device name.

def get_device_topic(self): """ Get the customized device topic using the device name and the root topic. Returns: str: The device topic in the form /root_topic/device_name""" root_topic = self.ROOT_TOPIC if "root_topic" in self.mqtt_cfg: root_topic = self.mqtt_cfg["root_topic"] if "root_topic_only" in self.mqtt_cfg: return root_topic else: normalized_name = self.controller.connection.name normalized_name = normalized_name.replace(" ","_") normalized_name = normalized_name.replace(":","_") normalized_name = normalized_name.replace("/","_") return "/".join([root_topic,normalized_name])

@mduran80
Copy link
Owner

mduran80 commented Nov 7, 2022 via email

@mduran80
Copy link
Owner

I updated the library (0.2.8) so the address is always sent as part of the root topic (instead of the name provided by the bluetooth connection). Anyway, using the root_topic_only is still supported with slight changes to what you proposed.

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

No branches or pull requests

2 participants