toblum / McLighting

The ESP8266 based multi-client lighting gadget
MIT License
1.05k stars 291 forks source link

Ha autodiscover not work :( #392

Closed Maurotb closed 5 years ago

Maurotb commented 5 years ago

Hi, i have followed this how to https://github.com/toblum/McLighting/wiki/Homeassistant-integration to enable autodiscover of mqtt mclighting but now work... Mclighting send only this 1556551984: Sending PINGRESP to McLighting-Ingresso 1556551995: Received PINGREQ from McLighting-Ingresso 1556552011: Received PUBLISH from McLighting-Ingresso (d0, q0, r0, m0, 'McLighting-Ingresso/out', ... (37 bytes)) 1556552011: Received SUBSCRIBE from McLighting-Ingresso 1556552011: McLighting-Ingresso/in (QoS 0) 1556552011: Sending SUBACK to McLighting-Ingresso 1556552011: Received PUBLISH from McLighting-Ingresso (d0, q0, r0, m0, 'McLighting-Ingresso/status', ... (6 bytes)) 1556552011: Sending PUBLISH to McLighting-Ingresso (d0, q0, r1, m0, 'home/McLighting-Ingresso_ha/state/in', ... (16 bytes))

Not send the PUBLISH /config and HA not discover it. If i set manually in configuration.yaml it work, nut, how enable autodiscover? HA 0.89.1 McLighting latest i use lolin D1 Mini Pro,compiled with platform.io , line DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH have effect?

this is my platformio.ini

[common] build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH -DMQTT_MAX_PACKET_SIZE=512 ; PubSubClient Specific flags -w ; supress all warnings

lib_deps = WiFiManager@0.14 AsyncMqttClient ArduinoJson WS2812FX NeoPixelBus WebSockets ESPAsyncE131 ESPAsyncUDP PubSubClient ;neede for #define ENABLE_MQTT FastLED ;needed for #define CUSTOM_WS2812FX_ANIMATIONS

[env:d1_mini_pro] platform = espressif8266 board = d1_mini_pro framework = arduino lib_deps = ${common.lib_deps} build_flags = ${common.build_flags}

Thanks

debsahu commented 5 years ago

Follow instructions from here: https://github.com/toblum/McLighting/wiki/Homeassistant-integration#homeassistant-mqtt-auto-discovery

Maurotb commented 5 years ago

I have followed instruction, only difference is i use platform.io...

debsahu commented 5 years ago

PIO works great, shouldnt matter.

  1. Is MQTT discovery enabled in HA https://www.home-assistant.io/docs/mqtt/discovery/ ?
    mqtt:
    discovery: true
    discovery_prefix: homeassistant
  2. What is the output of http://<ESP_IP_ADDRESS>/esp_status?
Maurotb commented 5 years ago

Yes, mqtt discovery work in my HA for other device connected with mosquitto and zigbee2mqtt

This is my HA config mqtt: discovery: true discovery_prefix: homeassistant broker: 192.168.210.10 port: 1883 client_id: home-assistant username: xxx password: xxx

First McLighting

{"HOSTNAME":"McLighting-Ingresso","version":"2.2.4","heap":12152,"sketch_size":658768,"free_sketch_space":1437696,"flash_chip_size":16777216,"flash_chip_real_size":16777216,"flash_chip_speed":40000000,"sdk_version":"3.0.0-dev(c0f7b44)","core_version":"2_5_0","cpu_freq":80,"chip_id":1589487,"animation_lib":"WS2812FX","pin":5,"number_leds":896,"button_mode":"ON","amqtt":"ON","home_assistant":"ON","legacy_animations":"ON","esp8266_http_updateserver":"ON","state_save":"SPIFFS"}

Second

{"HOSTNAME":"McLighting-Corridoio","version":"2.2.4","heap":11296,"sketch_size":658784,"free_sketch_space":1437696,"flash_chip_size":16777216,"flash_chip_real_size":16777216,"flash_chip_speed":40000000,"sdk_version":"3.0.0-dev(c0f7b44)","core_version":"2_5_0","cpu_freq":80,"chip_id":1589487,"animation_lib":"WS2812FX","pin":5,"number_leds":975,"button_mode":"ON","amqtt":"ON","home_assistant":"ON","legacy_animations":"ON","esp8266_http_updateserver":"ON","state_save":"SPIFFS"}

debsahu commented 5 years ago

Did you uncomment #define MQTT_HOME_ASSISTANT_SUPPORT in definitions.h? https://github.com/toblum/McLighting/blob/090bddd32b2705f5edb7ec999cb26c50dc470151/Arduino/McLighting/definitions.h#L20

Maurotb commented 5 years ago

Harg! No :( Sorry for my error

debsahu commented 5 years ago

That was the first instruction on https://github.com/toblum/McLighting/wiki/Homeassistant-integration#homeassistant-mqtt-auto-discovery !

Please reopen if you are still facing issues.