🇺🇦 We stand with Ukraine! 🇺🇦

Any TuyaSmartplug users here? - unknown command

Hey there,

I'm running the Tuya plugin to shutdown the printer. It works with the plugins interface button and also with OctoApp unless I use the gcode command which is M80/81 "192.168..." or @TUYAOFF "192.168...".
Then I get an unknown command reply by the Terminal. I did ask in the github repo for help but it seems the creator isn't active any more.
Strangely enough I also installed PSU control to be able to shut the printer down in idle after specific time which does also use the M81 gcode. The PSU plugin got this working. This error was present before PSU control so I don't think the two plugins interfere each other. Anyone can share a light on this issue?

octoprint(1).log (1.3 MB) plugin_tuyasmartplug_debug.log (13.8 KB)

I can't help you with your problem, but I got a suggestion: update to the tasmota firmware if possible.

Both plugin and firmware are working great.

I've got a different suggestion... Send a Tuya Smart Plug (along with a tip) to @jneilliii (you can contact him privately for shipping details).

Well I read into the firmware upgrades a time ago but I decided, as the plugs are working and I got enough projects and hobbies, not to do such hassle for a power plug. Don't know the reason why I should send it to someone as they are working fine.
Just OctoPrint has a problem with the M81 command and it's plugin. They do always work with the interface button TSP creates.

Yeah, as @PrintedWeezl mentioned you can flash tasmota and use that plugin of mine. I don't know specifically about tuya plugin, but think it was based/ forked from my tplink plugin and requires additional parameters to the M81 command.

@Mike804 I suggested sending a plug so that @jneilliii could "fix" the plugin. It is difficult to debug software that interfaces with hardware without having the hardware available.

The software source for the plugin is available so you can "fix" it yourself since you have the hardware at your disposal.

Ah OK. Your plugin is way more popular doing a research to this type of function. But well I have those SmartLife plugs here and they are the most sold here in my country. Never heard of TP link before. So if I had the choice I would have gone the route with more support. I think the TuyaPlugin is buggy somehow as sometimes the M81 does work even if the terminal shouts not knowing the command. Maybe there is someone in here who found a workaround.

My TPLink and Tasmota plugins are at the same level of feature compatibility as they both are the two most popular IoT power related plugins I've made. Like I mentioned, you could figure out the process of flashing Tasmota firmware on the Tuya and use the Tamota plugin to control it but you might seek out help from the plugin's issue tracker as well. It seems there are already a few issues posted specifically about your M81 issue. Issues · ziirish/OctoPrint-TuyaSmartplug · GitHub

If you are willing to flash it, you could also consider OctoPlugout. No plugins needed and the button of the plug becomes the printers on/off switch, which shutdowns the Pi provided no print job is running and provided that the extruder has cooled down sufficiently. It can also shutdown automatically after a print job. See: GitHub - ruedli/OctoPlugout: Customize a Sonoff plug for Octoprint communication and power switching

It seems there are already a few issues posted specifically about your M81 issue.

Yeah, the one post on the top is mine. I did go through the list and it seems I'm the only one having issues with the gcode command.

No plugins needed and the button of the plug becomes the printers on/off switch, which shutdowns the Pi provided no print job is running and provided that the extruder has cooled down sufficiently.

Well that already does PSU control for me. Only thing is the print end gcode which doesn't fire because of the mentioned issue.

I'm still on the point that this is a OctoPrint related issue as the plugins interface button works and the PSU plugin is also able to shutdown the plug via the Tuya plugin. The only thing that doesn't work is the command through the terminal.
I would love to use what is there and not be forced to hack around and tinker.

It's possible that one plugin could "eat" the command up and not forward it along to other plugin to handle. That was one of the reasons I added custom @ command support to my plugins to handle that use case, but I see you say the same issue happens with the @TUYAOFF command.

Yes that @TUYAOFF is not working either contradicts the theory. I wonder what a command gets send when one is using the interface button. The button always works. It is bind to an user query "do you really want this...". The debug didnt show what was send or I am unexpierence with it that I didnt see it.
What else makes me wonder is why the PSU control plugin seems to trigger the Tuya state successfully every time with its Idle function. In my understanding PSU also just sends the M81..