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

Public access to MQTT client functions #176

Closed
CarstenGrohmann opened this issue Jun 8, 2024 · 1 comment · Fixed by #183
Closed

Public access to MQTT client functions #176

CarstenGrohmann opened this issue Jun 8, 2024 · 1 comment · Fixed by #183
Labels
enhancement New feature or request

Comments

@CarstenGrohmann
Copy link
Contributor

Hello!

I am writing a simple plugin to publish all values to Home Assistant.

Currently I am using the MQTT client from DeyePluginContext.mqtt_client. Unfortunately, the client does not have a public function to publish a message to MQTT.

Therefore, I am currently “abusing” the protected function __do_publish():

self._mqtt_client = plugin_context.mqtt_client
self._mqtt_client._DeyeMqttClient__do_publish(topic, payload)

I prefer to use the existing connection. What do you think about adding public functions for publishing and subscribing to the DeyeMqttClient class? Or do you prefer to instantiate a separate MQTT client for the plugin?

Would you exclude a PR to integrate the plugin into your repo or do you prefer adding it to your own repo?

Kind regards,
Carsten

@CarstenGrohmann CarstenGrohmann added the enhancement New feature or request label Jun 8, 2024
@kbialek
Copy link
Owner

kbialek commented Jun 8, 2024

What do you think about adding public functions for publishing and subscribing to the DeyeMqttClient class?

Fair point. The method should be public. I will change that.

Or do you prefer to instantiate a separate MQTT client for the plugin?

It's up to the plugin implementer which connection to use, but the service connection should definitely be usable by the plugin. That is the reason why I made it available.

Would you exclude a PR to integrate the plugin into your repo or do you prefer adding it to your own repo?

The plugin has its own lifecycle, that's independent of this tool. Thus, please keep the plugin in your own repo. I can link it in the readme file if you want.

@kbialek kbialek linked a pull request Jun 24, 2024 that will close this issue
@kbialek kbialek closed this as completed Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants