MQTT Syntax adafruit motor shield (Stepper)

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kirelam
Normal user
Posts: 29
Joined: 04 Apr 2016, 12:10
Location: Westervoort

MQTT Syntax adafruit motor shield (Stepper)

#1 Post by kirelam » 02 Sep 2020, 14:47

IOT'er,

Anyvbody experience with the Adafruit Motorshield with Stepper driver?

I need the Rule for commanding the rotation and the release.

I'm guessing that this should be done within 1 or 2 rules in ESPeasy, and kicked of with a MQTT cmd, True?

If so what is this Syntax, or how to get it?
I managed to get switches and sensors working!

Kind regards,
Kirelam

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT Syntax adafruit motor shield (Stepper)

#2 Post by TD-er » 02 Sep 2020, 14:53


kirelam
Normal user
Posts: 29
Joined: 04 Apr 2016, 12:10
Location: Westervoort

Re: MQTT Syntax adafruit motor shield (Stepper)

#3 Post by kirelam » 02 Sep 2020, 15:00

No it is a plugin that is in beta.

https://www.letscontrolit.com/wiki/inde ... ield_v2%22

Works like a charm for me under http. But i am moving to HA so i need to control it through MQTT.

Kind regards,
Kirelam

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT Syntax adafruit motor shield (Stepper)

#4 Post by TD-er » 02 Sep 2020, 15:05

Ah this one, with clearly a very minimalistic styled documentation: https://espeasy.readthedocs.io/en/lates ... #p048-page

From the comments in the source code:

MotorShieldCMD,<DCMotor>,<Motornumber>,<Forward/Backward/Release>,<Speed>
MotorShieldCMD,<Stepper>,<Motornumber>,<Forward/Backward/Release>,<Steps>,<SINGLE/DOUBLE/INTERLEAVE/MICROSTEP>

kirelam
Normal user
Posts: 29
Joined: 04 Apr 2016, 12:10
Location: Westervoort

Re: MQTT Syntax adafruit motor shield (Stepper)

#5 Post by kirelam » 02 Sep 2020, 15:12

Will try thanx!!

kirelam
Normal user
Posts: 29
Joined: 04 Apr 2016, 12:10
Location: Westervoort

Re: MQTT Syntax adafruit motor shield (Stepper)

#6 Post by kirelam » 13 Sep 2020, 11:53

Anyone an idee how the MQTT commands look?

I cannot get the module to recognize the commands


MotorShieldCMD,<DCMotor>,<Motornumber>,<Forward/Backward/Release>,<Speed>
MotorShieldCMD,<Stepper>,<Motornumber>,<Forward/Backward/Release>,<Steps>,<SINGLE/DOUBLE/INTERLEAVE/MICROSTEP>

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT Syntax adafruit motor shield (Stepper)

#7 Post by TD-er » 13 Sep 2020, 12:03

Well sending via MQTT is not something I tried myself.
But in general, the commands should be formatted just as if you sent them via the command field on the tools page.

The options are almost all strings, so:
- Command is MotorShieldCMD
- Motor type = "DCMotor" or "Stepper"
- Motornumber is an int.
- action is Forward/Backward/Release
- action parameter is an int (0 ... 255)

So an example of a command can be:
MotorShieldCMD,DCMotor,0,Forward,10

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT Syntax adafruit motor shield (Stepper)

#8 Post by TD-er » 13 Sep 2020, 12:43

I also added the same info to the main documentation, to help others too.

https://espeasy.readthedocs.io/en/lates ... #p048-page

kirelam
Normal user
Posts: 29
Joined: 04 Apr 2016, 12:10
Location: Westervoort

Re: MQTT Syntax adafruit motor shield (Stepper)

#9 Post by kirelam » 13 Sep 2020, 21:12

So something like this?

MQTT: ChickenBot/MotorShieldCMD,Stepper,M1
And than with the load: Release or backward,2000,double

Cause this does not work with Home Assistant.

This is what i have in Home assistant now:

- platform: mqtt
name: "ChickenBot"
state_topic: "/ChickenBot/Button/State"
command_topic: "ChickenBot/MotorShieldCMD,Stepper1"
payload_on: Release
optimistic: true
qos: 0
retain: true
value_template: '{{ value.x }}'

I am vallueing your advice!!
Greetz,
Kirelam

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT Syntax adafruit motor shield (Stepper)

#10 Post by TD-er » 13 Sep 2020, 22:17

2000 is not in the range of 1...255.

kirelam
Normal user
Posts: 29
Joined: 04 Apr 2016, 12:10
Location: Westervoort

Re: MQTT Syntax adafruit motor shield (Stepper)

#11 Post by kirelam » 13 Sep 2020, 22:20

Ok, but the release command is also not coming through?

That one has a simple syntax with no parameter!

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT Syntax adafruit motor shield (Stepper)

#12 Post by TD-er » 14 Sep 2020, 00:24

Like I said, I haven't tried the commands via MQTT myself.
According to the documentation, you should add "cmd" to the topic: https://espeasy.readthedocs.io/en/lates ... -reference

The command itself does work when you enter it in the command field on the tools page?

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 49 guests