Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Enhancement Request: MQTT Control #22

Closed
noisufnoc opened this issue May 25, 2017 · 19 comments
Closed

Enhancement Request: MQTT Control #22

noisufnoc opened this issue May 25, 2017 · 19 comments
Assignees

Comments

@noisufnoc
Copy link

Hello,

Thank you for this project, I have been trying to reliably control a NeoPixel with an ESP8266 and you made it very easy. Ultimately I would like to control this light via my home automation platform Home Assistant. MQTT control of the lights would make this integration very easy.

Thoughts?

@toblum toblum self-assigned this May 26, 2017
@toblum
Copy link
Owner

toblum commented May 26, 2017

Hi,

I think there is already a way to implement this with Home Assistant using the REST API, but I don't know HomeAssisant in detail. Nevertheless MQTT would be nice to have and I definitely will look into this when I find time. The PubSub library uses some additional RAM and memory, so I will have to try out if it's working with all libraries enabled.

If you or someone else will do the first step on the integration I would definitely integrate this into McLighting.

Regards
Tobias

@thundergreen
Copy link

+1 for home assistant integration with MQTT. I will maybe buy another esp to test this :)

@LeonVos
Copy link

LeonVos commented Jun 21, 2017

i just added MQTT to MCLighting.ino.
Page is in request

master...LeonVos:patch-1

@thundergreen
Copy link

Awesome! It's already in master branch ? Wanna check this out

@thundergreen
Copy link

thundergreen commented Jun 22, 2017 via email

@thundergreen
Copy link

I overflew the file and couldn't locate mqtt username and password . Neither topic .I might have read a bit too fast and on the phone but I was just wondering if I miss something ?

@LeonVos
Copy link

LeonVos commented Jun 22, 2017

User&Passw is not needed for this , topics are at the end (ws2812-set/mode, ws2812-set/state )

Remind you that the control for mode does not work yet.

I use io-broker, for H.A.. integration search for " mqtt home assistant" lots off sources for it.

@thundergreen
Copy link

thundergreen commented Jun 22, 2017 via email

@toblum
Copy link
Owner

toblum commented Jun 23, 2017

@LeonVos Great! I will have a look at it as soon as I'm back from holidays and find time.

Could you file this as a pull request in the McLIghting repo? Then I will create a standalone branch where we can test and do enhancements.

Regards

@toblum
Copy link
Owner

toblum commented Aug 6, 2017

Plese have a look here: #26 (comment)

@toblum toblum closed this as completed Aug 6, 2017
@nimbl
Copy link

nimbl commented Aug 9, 2017

First off, thanks for the great repo. I have two things to mention in reference to this new MQTT functionality that was added to the master branch.

  1. I suggest refactoring the infinite mqtt connection loop to give up after a few retries. Right now, if the mqtt connection isn't established, then the webserver and websocket server will hang. At: I suggest something like this instead:
    if (!mqtt_client.connected()) { if(mqtt_reconnect_retries < mqtt_reconnect_retries_max){ mqtt_reconnect(); } }else{ mqtt_client.loop(); }
  2. As a hint as to why large messages aren't working in pubsubclient, as mentioned in this todo:
    // TODO: Fix this, doesn't return anything. Too long?

It seems that the pubsubclient doesn't respect redefining of MQTT_MAX_PACKET_SIZE, as you have in definitions.h. So any message over 128 bytes won't be sent. You can change this as a build option if using PlatformIO, but not with the Arduino IDE. See this issue knolleary/pubsubclient#110

Hope this info helps, and I'm not posting this into the wrong place. Thanks for the excellent software.

@toblum
Copy link
Owner

toblum commented Aug 11, 2017

Thank you @nimbl. I will have a look at it as soon I find time.

@toblum toblum reopened this Aug 11, 2017
@thundergreen
Copy link

why do i get

*WM: host
*WM: Adding parameter
*WM: port
*WM: Adding parameter
*WM: user
*WM: Adding parameter
*WM: pass
*WM: 
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster

and it just wont connect and how is the wifimanager supposed to work? which address do i have to type in?

@LeonVos
Copy link

LeonVos commented Aug 12, 2017

Hi, you need to connect your wifi with the esp (ssid looks like "espxxxx") default ip is 192.168.1.4

@toblum
Copy link
Owner

toblum commented Aug 12, 2017

IP should be: 192.168.4.1 I think
@thundergreen It Looks like your Board has stored valid credentials. Maybe you used it with wifimanager before.
You could uncomment the line with wifimanager.resetsettings(). In McLighting.ino. Then run one time to reset everything. Then comment it again.

@thundergreen
Copy link

how would i reset it then ? will try this again now

@thundergreen
Copy link

i reset it by uncommenting .. commted it again and it runs as accesspoint now .. strange

@toblum
Copy link
Owner

toblum commented Aug 19, 2017

Dear @thundergreen,
I hope everything is OK now. I will close the issue. If there are still problems, please just open a new issue.
Regards
Tobias

@toblum toblum closed this as completed Aug 19, 2017
toblum added a commit that referenced this issue Aug 19, 2017
@toblum
Copy link
Owner

toblum commented Aug 19, 2017

@nimbl
As proposed by you, I added a limit to the MQTT connections tries: 91571ea

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants