Sending command

Hi All

need to send a commands to a wemos D1 mini running tasmota with a motor shield on it and not sure how for example to turn motor 1 on running CCW at speed 10%

driver44 SETMOTOR,0,1,10

any help would be appreciated

Thanks Stuart

How did you send this command (“Commands can be issued using MQTT , web requests , webUI console and serial” )
I’m using MQTT ( as a lot of other users…), looking at console of the device (just type the ip onto the browser) you can see the used messages.
Is driver44 the name of your device?

sent the command in the console window via tasmota but want to send via mqqt on a button

Are you using mqtt v1 or v2?

:thinking: Can’t find a command SETMOTOR on the Tasmota documentation, Stepper Motors is the closest I can find.

With the assumption that drive4 is the name of your device as a MQTT command I would try cmd/driver44/SETMOTOR,0,1,10
But that is a pure guess, since I don’t have such a device nor can I find that command in the docs. However you stated it works.

MQTT version 2


I know its not in the docs was very hard to find how to control these boards had to upload new firmware for them to work had it for about 3 weeks before i could control it

Looking at your console the name of the device is Blind2, I am not sure where and how the driver44 fits in here.
I would assume an mqtt commandTopic starting with cmnd/Blind2/ , it migth be that the part driver44/SETMOTOR,0,1,10 would fit into the custom on value, but what should it be for the off command?
Sorry, but my help/ knowledge here is rather limited.
I personally would test some mqtt commands (topic plus custom on/offvalue) on the console or even better with another client like mqttfx in order to find a usable command.

to turn off driver44 SETMOTOR,0,3,0 and yes yo look at the device its blind2 want to run a vertical blind with it will have 4 in total to control
the start for MQTT would be cmd/blind2/driver44 i think then its the json transformation JSONPATH:$.SETMOTOR then not sure how to put the numbers in to it from there with the , as need to be able to put different values in to them

Command format:

  • driver44 ,,{,}
  • command:
  • RESET - reset a motor shield
  • SETMOTOR - seter motor state
  • motor:
  • 0 - motor A
  • 1 - motor B
  • direction:
  • 0 - short break
  • 1 - CCW
  • 2 - CW
  • 3 - stop
  • 4 - standby
  • duty (optional):
  • 0 - 100% (100% by default)

Where did you copy the command format information from? Might give us a clue…

Either way: you should first try to control the motor via MQTT outside of openHAB, such as using MQTT Explorer, mqtt.fx or Mosquitto’s built-in message sending functions. That way you can be certain that openHAB itself isn’t causing issues.

Once you’ve got the MQTT topics and messages sorted, then try to bring it into openHAB.


they are the direct commands from tasmota to control the motor shield from the console and will have a look at fx see if the commands can be sent direct but they should be
the driver44 is for the I2C bus

You could also try and see whether you can control the motor via http. Try the following url in your browser:

192.168.1.81/cm?cmnd=driver44%20SETMOTOR,0,1,10

Also, in your Tasmota console, type weblog 4 then hit enter - this may give you more information.

If the http command works, I would then try using one of the MQTT programs to send

SETMOTOR,0,1,10

to the topic

cmnd/Blind2/driver44

With mosquitto_pub you could just enter the following command into your terminal:

mosquitto_pub -t "cmnd/Blind2/driver44" -m "SETMOTOR,0,1,10"



that works so just need to know how to publish that in openhab

but need to be able to change values in the command if posible and get command error

Yeah, this isn’t simple.

For a start, you’ve put the transformation into Incoming, which won’t help.

You’ve got some research ahead of you. I would take this in the following steps:

  • Create items which correlate to the arguments that you want to send with SETMOTOR
  • Create a Sitemap that enables you to change the values of these items
  • Create a rule which triggers when any of these items change value. You will need to send the MQTT message from this rule using the MQTT Action which comes with the MQTT binding.

One thing to note: Tasmota doesn’t seem to return a very useful message in its RESULT topic. As a result you can’t use it to determine what the motor is currently doing, or what it is set to.

ok thanks will have a look at doing it in rule or node red will only need to be on for about 20 seconds just to turn a blind 90 degrees to open or close just thought that there might be a way to do it with in openhab

Everything I described is done in openHAB. But yes, it may be easier to do this using nodeRed. At least you have the MQTT message sorted!!

thank for your time will have a look at doing it that way just got to make a few parts to get it all running lol its on the test bench ATM

I use config files to add all my tasmota things using vs code.

In tasmota I setoption4 1 Which changes the result to mqtt to make it easier to understand.

Thing File

Bridge mqtt:broker:myMQTTBroker [ host="openhab", secure=false, username="user", password="pass" , clientID="myMQTTClient" ]
{
 
    Thing topic blind2 "Bedroom Blinds" {
    Channels:
        Type string : driver44   "Dining Light "  [ commandTopic="cmnd/Blind2/driver44"]
        
      }
}

That is it you dont want any json transform on it at all. its an outgoing channel

Then you need to create an item for it.

Items File

String Blind2 "Bedroom Blinds" {channel="mqtt:topic:myMQTTBroker:blind2:driver44"}

Then you can control it within a rule

Blind2.sendCommand("SETMOTOR,0,1,10")
3 Likes