McLighting (Another take on Bruh's ESP-MQTT-JSON-Digital-LEDs)

@swifty Could you open an issue on GitHub and provide in detail what code you are using, which version (goto: http:///esp_status), type of LED used etc. Also a serial log would be great.

I’m really glad to see that others are having the same issues with their LEDs turning off at random times, and it’s not just me. I did see this: ā€œHow To: Pick the right pins on the NodeMCU ESP8266 and ESP32ā€, YouTube video recently, and was going to try to use a different output pin to see if that made the turning off issue disappear; since I used pin D6 like probably a lot of other people did.

Either way, I’m not smart enough to contribute much yet, but I’ll be standing by watching/hoping for a great outcome lol.

Thanks @debsahu - Managed to get it working now… embarrassingly i’d typo’d the MQTT port number in the config :stuck_out_tongue:

When I couldn’t get the Android APK working reliably I assumed I’d done something wrong, but as soon as I fixed the MQTT port, it works seamlessly with HA.
I’m using the WS2801 branch you made, all effects I’ve tried work great, apart from ā€˜breath’ which seems to causes the leds to stop responding.

Thanks :smiley:

@debsahu You have a great project here! Just passing by to say thank you! Its working like a charm!

Best regards!

1 Like

Cannot get this to compile - get an error - ā€˜DynamicJsonBuffer’ was not declared in this scope - tried making sure I had all the right library versions etc and it will not compile. Did anyone else run into this?

Install correct version of ArduinoJSON.

Which version? I tried l Iike 3-4 versions based on documentation on the github page, no dice.

As of today you can use https://github.com/bblanchon/ArduinoJson/releases/tag/v6.5.0-beta

Thanks! I’ll try to give it a go when I get a moment :slight_smile:

I used https://github.com/toblum/McLighting as it is recently updated and it states than Home Assistant is supported.
When I go to the webpage of the ESP8266 I get the webinterface and the ledstrip is fuctional.

I added https://github.com/toblum/McLighting/blob/Before_AMQTT_NeoAnimationFX/clients/HomeAssistant/light.yaml to the configuration.yaml

I get the error:
Platform not found: light.mqtt_json
Invalid config for [automation]: expected str for dictionary value @ data[ā€˜id’]. Got None.

Any idea what i’m doing wrong?

Oke changing:

  • platform: mqtt_json
    to
  • platform: mqtt
    schema: json
    gets rid of the Platform not found error.
1 Like

The latest McLighting takes care of the change to MQTT JSON light since HA version 0.84. As suggested above, new client configuration is https://github.com/toblum/McLighting/blob/master/clients/HomeAssistant/light.yaml

1 Like

Best LED lighting project out there at moment. It will be even better when E1.31 gets implemented, thanks to @debsahu

Ok, I used the new light.yaml and added the following code to configuration.yaml

mqtt:
broker: 192.168.1.105
port: 1883
client_id: home-assistant
keepalive: 60
discovery: true
discovery_prefix: homeassistant

Home Assistant config checker indicated that the automation id’s should be str, so I changed them to id: ā€œneo1ā€ and id: ā€œneo2ā€. Config check is ok now.

After reboot of HA I get a slider but the ledstrip is not responding. Should there also be a effect-selector?

Some more experimenting and even found https://github.com/toblum/McLighting/issues/223 (what didn’t help either).

Only thing I edit in definitions.h is
uncomment #define MQTT_HOME_ASSISTANT_SUPPORT
uncomment #define WIFIMGR_PORTAL_TIMEOUT 180
uncomment #define WIFIMGR_SET_MANUAL_IP

and set a fixed ip
#ifdef WIFIMGR_SET_MANUAL_IP
uint8_t _ip[4] = {192,168,1,105};
uint8_t _gw[4] = {192,168,1,1};
uint8_t _sn[4] = {255,255,255,0};
#endif

web-ui is working fine, but in HA I don’t get the light button/switch.

All instructions are here: https://github.com/toblum/McLighting/wiki/Homeassistant-integration did you use the higher bandwidth option?

It might just be that you have set a different HOSTNAME. The MQTT topics are based on your HOSTNAME! Automation for speed sliders can’t be added in MQTT Discovery. One has to manually add them and use the correct MQTT topics. Without the sliders you will be stuck in default speed, which should be reasonable for most animations.

I didn’t change the default hostname McLighting01, but now I have. I used Ledstrip01.
When I access 192.168.4.1 I can fill in MQTT values. Should this be done or can this be ignored?

In the light.yaml (which I copied in the configuration.yaml) I changed the HOSTNAME to.
I also removed the id: in de automations because they throw an error. The alias is now the leading (- ) row.

And I get this in the logging.
ERROR (MainThread) [homeassistant.components.mqtt] Failed to connect due to exception: [Errno 111] Connection refused

Sorry, I’am new to MQTT. HA I have learned a lot past weeks :slight_smile:

This helped me out. Thank you.

the NodeMCU has fixed ip on 192.168.1.105 and the HAraspberry 192.168.1.122

In the wifi page of the NodeMCU I used the following MQTT
192.168.1.122
1883
homeassistant
mqtt_password

I put

mqtt:
  broker: 192.168.1.105 (also tried 192.168.1.122)
  port: 1883
  client_id: home-assistant
  keepalive: 60
  discovery: true
  discovery_prefix: homeassistant  
  password: !secret mqtt_password  

in configuration.yaml
Also the content from light.yaml

I keep getting the error
ERROR (MainThread) [homeassistant.components.mqtt] Failed to connect due to exception: [Errno 111] Connection refused

Oke after installing mosquitto by following


no errors. But still no reaction on the ledstrip when I change the speed.

What can I do next?
Update:
I got it working! HOSTNAME changing resulted that old and new name popped up in HA.

Been using this for a few days now and love, couldn’t get home assistant to automatically see it but overall very good work thanks