mmakaay / esphome-xiaomi_bslamp2

ESPHome integration for the Xiaomi Mijia Bedside Lamp v2.
Other
204 stars 49 forks source link

A newbie needs help (integrate using MQTT in Jeedom) #100

Closed maxmontgmx closed 1 year ago

maxmontgmx commented 1 year ago

Hi all, I'm just flashing the bedside lamp. Everything seems to be working. The lamp is connected to me wifi network (see in the serial console) Now I try to connect to the lamp through MQTT (I need used that). I don't use Home assistant bu Jeedom with MQTT plugin. But I don't see any MQTT device. Hwo can I see if the lamp is working normally and is compatbile with MQTT protocole? Thanks in advance for your help

maxmontgmx commented 1 year ago

Hi all, it's working now with MQTT by adding section in config file. I see the state of the lamp (suscriber) but when I publish messahe to change the state, nothing happens (for example, bedside-lamp/light/bedside_lamp_rgbww_light/state/brightness/set)

Any idea? Thanks again for your help

mmakaay commented 1 year ago

Good that you found that you had to add mqtt: to the configuration and good to hear that it's working. At least up to a certain extend.

I have tried MQTT with the lamp in the past, integrated with Home-Assistant that way, and I was able to control the lamp. That was only for testing and currently I do not use it, but it tells me that it should be able to get it to work for you.

Most obvious issue could be that the topic is incorrect. Can you inspect the autodiscovery data that the MQTT component sends, and check if the topic that you tried matches the one that is published via autodiscovery?

maxmontgmx commented 1 year ago

I don't use Home Assitant but another system (Jeedom) which integrate MQTT plugin. I have inspected data and I receive payload to read the lamp state. But if you use this payload to set state, nothink is happen. I tried to add "on_json_message" section under "mqtt" section and it's workig. For example:

mqtt: broker: 192.168.0.105

on_json_message:

mmakaay commented 1 year ago

I don't know if the MQTT topic that you use if valid. I compiled a test lamp with MQTT and I was able to control the lamp both from Home Assistant using the standard GUI and from an MQTT client using topic:

  bedside-lamp-office/light/bedside_lamp_office_rgbww_light/state

and for example payload:

  {
    "effect":"None",
    "state":"ON",
    "brightness":12,
   "color_mode": "rgb",
    "color":{"r":0,"g":0,"b":255},
    "color_temp":0
  }

Based on this, I conclude that MQTT is working for changing the light settings, but that Jeedom does things in a non-compatible way.

maxmontgmx commented 1 year ago

Hi, I trust you. you dev in fantastic and sure that it's working at 100% but in my system I cant' change the lamp state. I tried exactly the same topic and payload as you and nothing happens on the lamp. I'm using Jeedom as client and mosquito as borker. I tried also MQTT explorer client.

in yaml file, I just added that :

mqtt: broker: 192.168.0.105

mmakaay commented 1 year ago

With "exactly the same", I presume that you did change the topic to match your endpoint?

I experimented with the mqttexplorer utility, a GUI app that lets you inspect and send MQTT messages.

If you keep having troubles and think that it's caused by the firmware, I'll have to direct you to the ESPHome community, since the MQTT component is not my code and I have very little practical experience with its implementation.

maxmontgmx commented 1 year ago

yes sure, I changed topic like that : bedside-lamp/light/bedside_lamp_rgbww_light/state

Ok I will do that. Thanks

mmakaay commented 1 year ago

Good luck, I hope you can get it to work with Jeedom.