MQTT-JSON web UI not working properly

I’ve got a NodeMCU connected to an LED strip and communicating back with the Home Assistant RPi using the MQTT_JSON platform.

I have it set to enable a couple of effects, brightness, and RGB for now. Here’s the code

- platform: mqtt_json name: strip1 state_topic: "ledstrip/strip1" command_topic: "ledstrip/strip1/set" effect: true effect_list: - fireflies - none brightness: true rgb: true optimistic: false qos: 0

This is just for development for now. But anyway, the device does indeed show up in the Home Assistant page. I have a bit of debugging to do regarding the on-off switch. But otherwise, brightness works fine. However, I have no effect options and no RGB color selection, both of which will be necessary to continue developing. Is there something wrong in my yaml, or should I start checking elsewhere?

U might want to give a shit at:

Make sure your space are correct in your yaml file.
I use following entry:

light:
  - platform: mqtt_json
    name: "lamp4"
    state_topic: "home/rgb4"
    command_topic: "home/rgb4/set"
    effect: true
    effect_list:
      - lightning
      - solid  
    brightness: true
    flash: true
    rgb: true
    optimistic: false
    qos: 0

If you have problem with the ON/OFF I imagine you mean that the status is not reported correctly in Hass.
That could be your problem, you can only access effect and RGB setup if the device is ON.

As long as your lamp appears as OFF in hass you can only access ON/OFF switch and the brightness shortcut.
When your light will appear as ON, you’ll be able to click on it and setup the effect/RGB color.

1 Like

Excellent. I didn’t realize these relied on the ON/OFF state being available. So in that case, I will shift focus to that area.

I just integrated my secrets.h so I could push to github, if you would like to take a look. It isn’t finished, but the important part will be the section “START SEND STATE”

OK, so I found out the problem.

For whatever reason, BRUH’s code was able to create an array using a non-static variable. I had to use
“new” and “delete” to create a new pointer to the buffer.

The problem was that sizeof(buffer) was returning the size of the pointer rather than the whole buffer. I updated the code to fix this, and everything seems to be working! Thanks, guys!

What is the difference between your code and bruh? I’d like having more effects .

Well I don’t have as many effects as he does quite yet, but I wanted to change the fundamental structure.

His code used basically a giant bunch of if statements which each took total control of the color of the lights.

In my case, I have a separate background layer and a foreground layer with different per-pixel blending options, such as add, multiply, and alpha. The foreground and background are function pointers. So you create a new function to set the foreground or background array colors. Then the final pass blends the two.

It may seem less efficient, but the idea is that you can create a simple toolbox of effects and combine them in various ways using various colors. What I would like to do is actually be able to control all these parameters with HA, but that seems a ways off.

There’s another project with also mqtt support but I forgot …let me search …

Here it is