Light is detected but the Hue app can't control anything

Hi guys!
I’m having trouble setting up my Teckin SB50 ( RGBWW) with ESPHome+DiyHue.I can add the light in the android Hue App but I can’t control it. I can’t turn it on/off and for any colors I choose, the light don’t respond. I try using the DiyHue web server but the same thing happen.

I can control the light perfectly on home assistant using the the lights ids (white_led, color_led) but nothing work when I use the DiyHue bridge. DiyHue is running on a Raspberry pi 3 b+ using docker.

Here is my .yaml file:

esphome:

  name: sb50_l1

  platform: ESP8266

  board: esp01_1m

  esp8266_restore_from_flash: true

  includes:

    - diyhueasyncudp-rgbww.h

    - alertswitch.h

  libraries:

    - git+https://github.com/me-no-dev/ESPAsyncUDP.git#697c75a0255e5dccf91b4ef8b5cc28c569b3bac9

custom_component:

- lambda: |-

    auto diyhue = new diyhueudp();

    return {diyhue};

wifi:

  ssid: "****

  password: ****

  

  ap:

    ssid: ****

    password: ****

# Enable logging to ESPHome

logger:

  # Disable logging to serial

  baud_rate: 0

# Enable Home Assistant API

api:

  password: ****

# Setup OTA password

ota:

  password: ****

# Define output pins

output:

  - platform: esp8266_pwm

    id: output_red

    pin: GPIO4

    

  - platform: esp8266_pwm

    id: output_green

    pin: GPIO12

  - platform: esp8266_pwm

    id: output_blue

    pin: GPIO14

  - platform: esp8266_pwm

    id: output_warm_white

    pin: GPIO13

  - platform: esp8266_pwm

    pin: GPIO12

    id: warm_white_gpio

    frequency: 1000 Hz

    inverted: False

    min_power: 0

    max_power: 0.7

        

  - platform: esp8266_pwm

    id: output_cold_white

    pin: GPIO5

    frequency: 1000 Hz

    inverted: False

    min_power: 0

    max_power: 0.7

light:

  - platform: cwww

    id: white_led

    name: "white_led"

    warm_white: output_warm_white

    cold_white: output_cold_white

    cold_white_color_temperature: 6200 K

    warm_white_color_temperature: 2800 K

    default_transition_length: 0.4s

  - platform: rgb

    id: color_led

    name: "color_led"

    red: output_red

    green: output_green

    blue: output_blue 

    default_transition_length: 0.4s

    effects:

      - random:

          name: Random Effect With Custom Values

          transition_length: 5s

          update_interval: 3s

text_sensor:

  - platform: template

    name: "light_id"

    id: light_id

    lambda: |-

      char response[100];

      memset( response, 0, 100 );

      strcat( response, "esphome_diyhue_light;");

      strcat( response, WiFi.macAddress().c_str());

      strcat( response, ";");

      strcat( response, App.get_name().c_str());

      strcat( response, ";0;0" ); // ;CT_BOOST;RGB_BOOST values go here; Replace with 0 to disable

      return { response };

    update_interval: 24h

switch:

  - platform: custom

    lambda: |-

        auto alertswitch = new alertSwitch();

        App.register_component(alertswitch);

        return {alertswitch};

    switches:

      name: alert

      id: alert

  - platform: template

    name: entertainment_switch

    id: entertainment_switch

    optimistic: true

    

web_server:

  port: 80

and my diyhueasyncudp-rgbww.h

#include "esphome.h"

#include <ESPAsyncUDP.h>

class diyhueudp : public Component {

 public:

  int lastUDPmilsec;

  int entertainmentTimeout = 1500;

  float maxColor = 255;

  AsyncUDP Udp;

  void setup() override {

    if(Udp.listen(2100)) {

        ESP_LOGD("DiyHueUDP", "Listerner Enabled");

        Udp.onPacket([&](AsyncUDPPacket &packet) {entertainment(packet);});

    }

  }

  void loop() override {

    if (entertainment_switch->state) {

      if ((millis() - lastUDPmilsec) >= entertainmentTimeout) {

        entertainment_switch->turn_off();

      }

    }

    //entertainment();

  }

  void entertainment(AsyncUDPPacket &packet)

  {

    ESP_LOGD("DiyHueUDP", "Entertainment packet arrived");

    if (!entertainment_switch->state) {

      entertainment_switch->turn_on();

    }

    lastUDPmilsec = millis(); //reset timeout value

    uint8_t *packetBuffer = packet.data();

    uint32_t packetSize = packet.length();

    auto call = color_led->turn_on();

    if (((packetBuffer[1])+(packetBuffer[2])+(packetBuffer[3])) == 0) {

      call.set_rgb(0,0,0);

      call.set_brightness(0);

      call.set_transition_length(0);

      call.perform();

    } else {

      call.set_rgb(packetBuffer[1]/maxColor, packetBuffer[2]/maxColor, packetBuffer[3]/maxColor);

      call.set_transition_length(0);

      call.set_brightness(packetBuffer[4]/maxColor);

      call.perform();

    }

  }

};

Thank you :slight_smile: