[SOLVED] ESP8285 WiFi RGB with IR + Tasmota not working with correct colors on OpenHab2

  • Platform information:
    • Hardware: Raspberry Pi 3
    • OS: Raspbian 9 (stretch)
    • Java Runtime Environment: openjdk version “1.8.0_232”
      OpenJDK Runtime Environment (build 1.8.0_232-8u232-b09-1~deb9u1-b09)
      OpenJDK Client VM (build 25.232-b09, mixed mode)
    • openHAB version: 2.5.0~S1742-1
  • Issue of the topic:

I based my work on this example and I’ve tried already every Module Configurations that there are mentioned.

I’ve also checked in many other topics such as this and this, but so far with no luck.

It matters to say that in this case I am using very little code, I’m mostly using Paper UI. So this is what I have right now.

On my .items file I have this:

Color Luz_RGB "Led Cores" ["Lighting"]
String Led_Cor "Cor Led [%s]"
Switch Led_Energia "Led TV [%s]" ["Switchable"]
Dimmer Led_Intensidade "Intensidade Led [%.0f %%]"

Then to get this panel on my Control screen:


I have it setup like so to work with colors:

On that green arrow I’ve already inserted different formats and none had impact.

Then I also have this Dimmer which is not working when I try to use it on my Control screen, but it does show the real Dimmer value:


So that’s it. I need once again your help guys because IR Remote is working perfectly, (almost) everything is perfect, except the colors that does not match the ones I try to set on the OH APP and on the Control screen.

Thanks in advance. :slight_smile:

I’m sorry to bump this, but does someone have any idea?

This sounds like the easier one to tackle to begin with.
What does your events.log show you when you try to use the UI to command it? Anything in your openhab.log at time?

That’s encouraging, basic MQTT setup is good.
You might find it useful to get a tool like mqtt.fx so that you can observe MQTT traffic through your broker.

Nothing on events.log neither on openhab.log but on Console inside Tasmota of the equipment, I see this:

12:48:34 MQT: stat/LuzesRGB/RESULT = {“POWER”:“OFF”,“Dimmer”:0,“Color”:“0,0,0,0”,“HSBColor”:“240,100,0”,“Channel”:[0,0,0,0]}

This was right after I moved the slider to 71%, so this always assumes 0 instead of the value I select there.

it will be very cool if you make it work … i wasnt able to…

ended up using my own node red flow to sned colors as strings
not the best soultion but for autmation purpuse it will get the job done

i just dont have pretty GUI

tell me if you want me to share the flow

1 Like

Okay, i suppose you have not linked any Item to this.

So you’d probably be interested in what was sent to the device, if anything.
That was what the mqtt.fx or similar was for.
What are you supposed to send, what is different?

Thank you for your kind offer. For now I will try to make it work by other means. If I see I am not able to, I might just get back to you. :slight_smile:

Numbers basically. It expects to receive a value and for some reason, or it is incorrectly formated and the device cannot read, making it always zero, or really nothing is being sent, which I doubt.

Regarding MQTT.FX, as far as I could understand, it’s not something easy peasy and straightforward to do, because it seems that it does not work out-of-the-box for Raspbian since it’s an ARM arquitecture.

Is there any other way to track MQTT communications?

There are other diagnostic tools. You don’t need to run them on your pi, they run anywhere and subscribe to your broker, wherever that is.

Otherwise, you need to use use your head.
What topic should you be sending commands to?
What payload should be sent to that topic? A number? or JSON? or?

you will do huminty a favor :slight_smile:

Hum, maybe I am not using it the right way, but isn’t this basically the same thing using this MQTT.FX or checking the Tasmota console on the equipment?

Hi,
I had a similar problem with the module LC02 it’s RGBW.
Try this settings:
Module Generic (18)
D1 GPIO5 ----> PWM2 (38)
D6 GPIO12 ----> PWM1 (37)
D7 GPIO13 ----> PWM3 (39)
D8 GPIO15 ----> PWM4 (40)

Tasmota console will show you incoming payloads for the topics it is subscribed to, I think.
Got any of those?

If not, what topics have you subscribed to? Are you sending OH commands to the correct topic?

Thanks @Alien but I had already tried that configuration with no success. Also, if I set those configurations like that, with my IR Remote I get Red changed by Green so I need to have the setup like so in order to have it working correctly:
Screenshot_2020-03-13_15-11-35

@rossko57 these are my settings right now:
Screenshot_2020-03-13_15-02-22

I have this channel

With this here as setup. I’ve also added bellow the ON and OFF and set to “ON” the “Is command”, but that just did nothing.

Out of curiosity, if I set the UI like so:
Screenshot_2020-03-13_15-09-37

In Tasmota Console this is what reaches there:
16:05:51 MQT: stat/LuzesRGB/RESULT = {“POWER”:“ON”,“Dimmer”:98,“Color”:“250,128,120,0”,“HSBColor”:“4,52,98”,“Channel”:[98,50,47,0]}

This makes no sense because colors seem to be sent wrong from OH.

And if I select the Channel type “Color value (Hue,Saturation,Brightness)” it’s even worst:
16:16:47 MQT: stat/LuzesRGB/RESULT = {“POWER”:“ON”,“Dimmer”:39,“Color”:“14,51,100,0”,“HSBColor”:“214,86,39”,“Channel”:[5,20,39,0]}

I’VE SOLVED THE PROBLEM!!! :smiley:

Sometimes I love myself. :stuck_out_tongue:

So, these were the last steps that made it to work properly for future reference to others:

  1. Having the item created (as in my first post) I created a Channel type “Color value (Red,Green,Blue)”
  2. I then setup the channel like so:
  3. Then I’ve linked the item (item type “Color”, which in my case is Luz_RGB) as JSONPATH: Screenshot_2020-03-13_15-27-07
  4. Last but not least, I’ve setup the JSONPath expression like $.Color Screenshot_2020-03-13_15-27-32

And that’s it, colors are finally properly syncronized! :smiley:

EDIT

Since this is the post marked with as Solution, for Dimmer I just had to select the Channel type as “Percentage value” because that’s what works for Dimmer.

SUGGESTION: Change name of that Channel type to “Percentage value (e.g. Dimmer)” so that people can avoid losing hours and hours like I’ve lost because of something as simple as a Channel type name.

Now, although the main topic here is solved, I still haven’t figured out why Dimmer is not working correctly. I’ve tested the same logic with Dimmer channel/item regarding JSONPATH, but it did not worked. It still get’s always zero.

If only you what it sent.

I am struggling to get what’s sent from OH to MQTT. How can I do that with MQTT.FX?

Ok, I think I’ve narrowed down the problem and it seems that value is being sent with quotation marks and therefore that’s why this get’s always zero. :slight_smile:

So, I’ve installed ReGex Transformation and I’ve been playing with it in Paper UI in the Outgoing value transformation but so far with no results.

This is what I’ve already tried without success: REGEX:(/"([^"]+(?="))"/g)

Is this even correct this way?

You listen to the topic you think you are sending data on

What makes you think that?
All MQTT payloads are technically strings, but quotemarks are not normally applied.
There is nothing in the channel config you showed us earlier that would add quotes to the format.

Have you found out what format you actually want to send? You can manually send that topic/payload from mqtt.fx and see if it works, for a better idea of what you’re trying to achieve

Ok, so it seems that MQTT.FX it’s not needed in this case.

Here’s the steps I did:

In the terminal I entered this: openhab-cli console

That started OpenHab console and then I inserted this: log:set DEBUG org.openhab.binding.mqtt

Then I just went to the item in Paper UI Control panel and set it to a value (ex: 42).

Then I went and checked the OH log file in /var/log/openhab2/openhab.log

I then saw this line: 2020-03-14 11:06:57.837 [DEBUG] [qtt.generic.AbstractMQTTThingHandler] - Successfully published value 0.42000000 to topic cmnd/LuzesRGB/Dimmer

Which means this is being sent as a decimal value instead of an integer.

EDIT

Now in Paper UI I changed my REGEX expression to this: REGEX:.(.2)

But in log I get this:

2020-03-14 11:29:23.925 [DEBUG] [ab.binding.mqtt.generic.ChannelState] - Transformation ‘0.40000000’ returned null on ‘REGEX’, discarding message
2020-03-14 11:29:23.930 [DEBUG] [qtt.generic.AbstractMQTTThingHandler] - Successfully published value 0.40000000 to topic cmnd/LuzesRGB/Dimmer

Okay, you found out what was being sent, and it’s not what you want.
(0.42 is 42% expressed as a fraction of 1, by the by)
Why are you not seeing that at the Tasmota console, is the topic correct?

Check the channel type used for your Dimmer Item … are you using number or dimmer type channel, different behaviours.

What REGEX? What are you trying to do there?