T
T
tmkbl2021-08-31 12:22:21
Python
tmkbl, 2021-08-31 12:22:21

How to control ESP8266 via mosquitto and python?

I am setting up a homemade Wi-Fi socket based on ESP8266 with tasmota firmware. I'm trying to make control through an external VDS server, the mosquitto mqtt broker has already been installed there.
So the question is: how to combine mosquitto with python so that you can turn on / off the outlet from the script? What library is needed and what should python send to the broker?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Shubin, 2021-08-31
@tmkbl

Any library for mqtt. Send a message to the desired topic, ESP, in turn, must be subscribed to this topic. Topics can be of a type esp<ID_устройства>/pin/8( in case there are several devices ), or you can simply example_topicsend messages like 0 or 1 there, on or off lines . You can, of course, at least encode json into a message, but the more difficult it is to parse it all on ESP. I recommend reading examples from the library.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question