I created a plugin to control the PSUControl plugin via MQTT or specifically with HomeAssistant.
As far as I can tell it works pretty reliable. More information you find on github.
I plan on releasing it in the repository some time later. But since this is my first plugin I haven't figured everything out yet.
One question I have is: Is there a way to test the update function without the plugin being registered in the repo?
The updates happen directly with github, so if you publish a release on github with tag that matches the version number in setup.py and install it, then update setup.py version number and release a new version you can test that.
The updater works now and thus the current version on github should be good enough for a first release. Planning to do that next week.
@jneilliii you seem to be familiar with mqtt plugins..Maybe you can help me out with another problem?
In my on_settings_save function (line 146) I want to unsubscribe and subscribe again to keep everything in sync with the settings. The mqtt plugin throws an error though.
File "/octoprint/plugins/lib/python3.8/site-packages/octoprint_mqtt/init.py", line 382, in mqtt_subscribe
self._mqtt_subscriptions.append((topic, callback, args, kwargs))
AttributeError: 'filter' object has no attribute 'append'
The way it is the error shows up if you do more than 1 change/save.
If I change the order to usubscrbe before subscribe the error comes up on save instantly.
So right now I don't unsubscribe the old topic which can result in unwanted behaviour until a restart happens.
I am working on putting it on the repo atm and have one more question:
In the <your plugin's identifier>.md can I also specify the compatibility with other plugins with their identifier? In this case it would only work with mqtt >= 0.8.10 for example.
Not currently. You can grab the plugin version though doing something like this
mqtt_version = None
for k, v in self._plugin_manager.plugin_implementations.items():
if k == 'mqtt':
mqtt_version = k._plugin_version
if mqtt_version:
print("MQTT Version: {}".format(mqtt_version))
else:
print("MQTT not found!")
Thanks! I decided to just place some little info to use the newest version of mqtt. People who install new plugins will probably keep their plugins up to date anyway.
Hi.
I installed PSU Control and MQTT for PSU Control and it seems that it should do what I want by sending MQTT commands directly without HomeAssistant or other home automation products but in PSU Control, I can't select "MQTT for PSU Control" but a lot of other plug-ins. Am I missing something or is it just a missing link here?
Svein.....
Someone else had this question on Discord recently. This plugin is for controlling PSU control using MQTT, not PSU Control sending commands to a smart socket over MQTT. The opposite direction to what you are trying to do. For example, you could configure PSU control as a device in Home Assistant to control it.
If you are using a device with Tasmota, there's dedicated plugins or a PSU control plugin for that that you can use instead (they're the most common MQTT plugs afaik).
I want to control any ordinary smart socket via MQTT. I have several other options to do that but it would be nice to be able to do it from Octoprint UI.