buxtronix / am43

Control AM43 blinds with an ESP32
MIT License
76 stars 25 forks source link

Updating Mosquitto broker to 6.0.1 stops AM43 from working #28

Open DaveTiff opened 3 years ago

DaveTiff commented 3 years ago

Hi, updated my Mosquitto broker from 5.1.1 to 6.0.1 stops AM43 from operating.

The Blue Tooth Enable works, but the components on HA dashboard remain Greyed Out. Restoring MQTT back to 5.1.1 cures this problem.

Regards, Dave

DaveTiff commented 3 years ago

Now not sure it is that, as it has now also stopped working with 5.1.1. Restarting Mosquitto broker allows it to work again.

It has been working fine for over a week, Now running HA 2021.5.5

Anyone else having problems.

Regards, Dave

DaveTiff commented 3 years ago

Another person is now having trouble with Mosquitto broker 6.0.1 and AM43.

https://github.com/buxtronix/am43/issues/27#issuecomment-846403962

CaptInsano commented 3 years ago

Also happening here. HomeAssistant 2021.5.5 Mosquitto: 6.0.1

All other MQTT devices (mainly Tasmota) all still working perfectly

Kite-Smurf commented 3 years ago

Hi, The exact same thing happens with my system too: updated my Mosquitto broker from 5.1.1 to 6.0.1 stops AM43 from operating.

The Blue Tooth Enable works, but the components on HA dashboard remain Greyed Out. Restoring MQTT back to 5.1.1 cures this problem.

Regards, Otto

balbulator commented 3 years ago

added a question in the mosquito thread [https://github.com/home-assistant/addons/issues/2030] support the question

belenkiy-lab commented 3 years ago

I have several curtains at home. half are connected via this integration, half are connected via test version in esphome after updating mqtt those connected via esphome remained working. the rest stopped working like everyone else.

balbulator commented 3 years ago

I have several curtains at home. half are connected via this integration, half are connected via test version in esphome after updating mqtt those connected via esphome remained working. the rest stopped working like everyone else.

tell me, how exactly did you connect the AM43 to ESPhome in the test?

belenkiy-lab commented 3 years ago

It worked for me if I specified "buxtronix: am43" in the Esphome version. After that, everything worked. It was in early March. When I tried to do similar actions in April, I get the same error as yours. therefore, I started new curtains not through esphome, but through native integration from buxtronix. I decided it was easier than trying to figure it out. I'm waiting for this integration to be in the esphome release to use it fully and monotonously at home.

У меня это работало если указать в версии Esphome "buxtronix:am43". После этого все работало. Это было в в начале марта. Когда я пробовал в апреле сделать аналогичные действия, я получаю ошибку, такую же как и у тебя. поэтому новые шторы я завел не через esphome а через родную интеграцию от buxtronix. Решил что это проще, чем разбираться. Жду когда данная интеграция будет в релизе esphome что бы использовать ее полноценно и однообразно у себя.

balbulator commented 3 years ago

none of the options work at the moment

belenkiy-lab commented 3 years ago

Use mqtt version 5.1.1 and this integration

balbulator commented 3 years ago

The problem is that I cannot roll back the mosquitoes

belenkiy-lab commented 3 years ago

what prevents you from installing a clean instalation of mosquito not from HA? on any computer on the network or docker?

balbulator commented 3 years ago

Everything interferes, on the PC not an option, on the docker, too, as on the Home Assistant

belenkiy-lab commented 3 years ago

https://1drv.ms/u/s!AgyPTdNGxaf8iY1lVEbLF46puzGa2A?e=vV0QSs

this is my mqtt snapshot as I understand you can restore 5.1.1 using it. will it help?

balbulator commented 3 years ago

https://1drv.ms/u/s!AgyPTdNGxaf8iY1lVEbLF46puzGa2A?e=vV0QSs

this is my mqtt snapshot as I understand you can restore 5.1.1 using it. will it help?

Thanks, I have installed the Mosquitto broker add-on Current version: 5.1.1, but after HA update (core-2021.6.2) the problem reappeared

DaveTiff commented 3 years ago

I am on core-2021.6.2 and Mosquitto broker 5.1.1 mine is still working ok

Re Dave

danilkorotkov commented 3 years ago

this is PubSubClient issue, not AM43

Kite-Smurf commented 3 years ago

this is PubSubClient issue, not AM43

Thanks for the updated news on this. The question is how to solve it? and how to get AM43 working with the mqtt 6.0 version?

danilkorotkov commented 3 years ago

Thanks for the updated news on this. The question is how to solve it? and how to get AM43 working with the mqtt 6.0 version?

you can include arduino-mqtt lib instead of PubSubClient lib and then check all of 22 mqtt methods in your/example sketch) ota update is available PubSubClient has no update since 2020 so it is possible that it is abandoned

balbulator commented 3 years ago

Maybe it's time to make changes to the repository? It feels like this project is abandoned

buxtronix commented 3 years ago

I've not got the bad mosquitto version so can't reproduce. Feel free to send a PR and I'll merge a fix that helps.

MrBigleg commented 3 years ago

Thanks for the updated news on this. The question is how to solve it? and how to get AM43 working with the mqtt 6.0 version?

you can include arduino-mqtt lib instead of PubSubClient lib and then check all of 22 mqtt methods in your/example sketch) ota update is available PubSubClient has no update since 2020 so it is possible that it is abandoned

Do you mind sharing your sketch? I tried and just go tonnes of errors compiling

CaptInsano commented 3 years ago

Has anyone got a solution for this issue when mosquitto is already at v6.0.1?

I unfortunately have no mosquitto snapshot at earlier version, all other MQTT integrations are still working great but no action from AM43 integration on my system.

Has anyone successfully ported the code to a different MQTT client?

timdonovanuk commented 3 years ago

Same issue here. It would help if the serial output had any info or debugging lines about MQTT, as I have no idea whats going on.

I can see it finding position and battery but nothing is sent to MQTT other than am43/enabled = ON

balbulator commented 3 years ago

Same issue here. It would help if the serial output had any info or debugging lines about MQTT, as I have no idea whats going on.

I can see it finding position and battery but nothing is sent to MQTT other than am43/enabled = ON

exactly the same with me

balbulator commented 3 years ago

https://github.com/buxtronix/am43/issues/21#issuecomment-880215140 Everything can be cured with ESPHome

Kite-Smurf commented 3 years ago

#21 (comment) Everything can be cured with ESPHome

Could you please share some instructions on how to set this up in ESPHome? I never used that before. Thanks for help.

balbulator commented 3 years ago

#21 (comment) Everything can be cured with ESPHome

Could you please share some instructions on how to set this up in ESPHome? I never used that before. Thanks for help.

Also important in -> Supervisor -> ESPHome -> Configuration -> esphome_version - buxtronix:am43 certfile - fullchain.pem keyfile - privkey.pem

esphome:
  name: cover
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "any password"

wifi:
  ssid: "Sergio"
  password: "Password"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Cover Fallback Hotspot"
    password: "StW7wyE8nD6N"

captive_portal:

esp32_ble_tracker:

ble_client:
  - mac_address: 01:02:03:AA:BB:CC
    id: blinds

cover:
  - platform: am43
    name: "Blinds in bedroom"
    id: cover_bedroom
    ble_client_id: blinds

sensor:
  - platform: am43
    ble_client_id: blinds
    battery_level:
      name: "Blinds battery"
    illuminance:
      name: "Blinds light"
    update_interval: 120s
  - platform: uptime
    name: Uptime Sensor

switch:
  - platform: restart
    name: "Device Restart"
  - platform: ble_client
    name: "Blinds  On"
    ble_client_id: cover
    id: right_on
don86nl commented 3 years ago

#21 (comment) Everything can be cured with ESPHome

Could you please share some instructions on how to set this up in ESPHome? I never used that before. Thanks for help.

Also important in -> Supervisor -> ESPHome -> Configuration -> esphome_version - buxtronix:am43 certfile - fullchain.pem keyfile - privkey.pem

esphome:
  name: cover
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "any password"

wifi:
  ssid: "Sergio"
  password: "Password"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Cover Fallback Hotspot"
    password: "StW7wyE8nD6N"

captive_portal:

esp32_ble_tracker:

ble_client:
  - mac_address: 01:02:03:AA:BB:CC
    id: blinds

cover:
  - platform: am43
    name: "Blinds in bedroom"
    id: cover_bedroom
    ble_client_id: blinds

sensor:
  - platform: am43
    ble_client_id: blinds
    battery_level:
      name: "Blinds battery"
    illuminance:
      name: "Blinds light"
    update_interval: 120s
  - platform: uptime
    name: Uptime Sensor

switch:
  - platform: restart
    name: "Device Restart"
  - platform: ble_client
    name: "Blinds  On"
    ble_client_id: cover
    id: right_on

This helped me, thanks!

sambeetm commented 2 years ago

Hi..first time with ESPHome. Followed all the above instructions and installed the add-on. Set the following configurations.

esphome_version: buxtronix:am43 certfile: fullchain.pem keyfile: privkey.pem

My .yaml file is as below and validates. But, throwing bunch of errors during install. Can somebody please suggest whats wrong here?

esphome: name: cover platform: ESP32 board: esp32dev

Enable logging

logger:

Enable Home Assistant API

api:

ota: password: "anypassword"

wifi: ssid: "xxxxxxx" password: "yyyyyyy"

Enable fallback hotspot (captive portal) in case wifi connection fails

ap: ssid: "ssssssss" password: "zzzzzzzz"

external_components:

captive_portal:

esp32_ble_tracker:

ble_client:

cover:

sensor:

switch:

Compilation Errors.....

INFO Reading configuration /config/esphome/blind-engine1.yaml... INFO Generating C++ source... INFO Compiling app... Processing cover (board: esp32dev; framework: arduino; platform: platformio/espressif32 @ 3.3.2)

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf Dependency Graph |-- 1.2.2 |-- 1.0 |-- 1.0 |-- 1.0 |-- 2.1.0 | |-- 1.2.2 |-- 1.1.0 |-- 1.0 Compiling /data/cover/.pioenvs/cover/src/esphome/components/am43/am43.cpp.o Compiling /data/cover/.pioenvs/cover/src/esphome/components/am43/cover/am43_cover.cpp.o src/esphome/components/am43/cover/am43_cover.cpp: In member function 'virtual void esphome::am43::Am43Component::loop()': src/esphome/components/am43/cover/am43_cover.cpp:26:27: error: 'Established' is not a member of 'esphome::esp32_ble_tracker::ClientState' if (this->node_state == espbt::ClientState::Established && !this->loggedin) { ^ src/esphome/components/am43/cover/am43_cover.cpp: In member function 'virtual void esphome::am43::Am43Component::control(const esphome::cover::CoverCall&)': src/esphome/components/am43/cover/am43_cover.cpp:48:27: error: 'Established' is not a member of 'esphome::esp32_ble_tracker::ClientState' if (this->node_state != espbt::ClientState::Established) { ^ src/esphome/components/am43/cover/am43_cover.cpp: In member function 'virtual void esphome::am43::Am43Component::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t)': src/esphome/components/am43/cover/am43_cover.cpp:97:26: error: 'Established' is not a member of 'esphome::esp32_ble_tracker::ClientState' this->node_state = espbt::ClientState::Established; ^ src/esphome/components/am43/am43.cpp: In member function 'virtual void esphome::am43::Am43::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t)': src/esphome/components/am43/am43.cpp:33:26: error: 'Idle' is not a member of 'esphome::esp32_ble_tracker::ClientState' this->node_state = espbt::ClientState::Idle; ^ src/esphome/components/am43/am43.cpp:56:26: error: 'Established' is not a member of 'esphome::esp32_ble_tracker::ClientState' this->node_state = espbt::ClientState::Established; ^ src/esphome/components/am43/am43.cpp:66:18: error: 'millis' was not declared in this scope millis() - this->last_batteryupdate > 10000) { ^ src/esphome/components/am43/am43.cpp: In member function 'virtual void esphome::am43::Am43::update()': src/esphome/components/am43/am43.cpp:95:27: error: 'Established' is not a member of 'esphome::esp32_ble_tracker::ClientState' if (this->node_state != espbt::ClientState::Established) { ^ [/data/cover/.pioenvs/cover/src/esphome/components/am43/cover/am43_cover.cpp.o] Error 1 [/data/cover/.pioenvs/cover/src/esphome/components/am43/am43.cpp.o] Error 1 ========================= [FAILED] Took 14.69 seconds =========================

Kite-Smurf commented 2 years ago

Do not use the external_components:

source: github://buxtronix/esphome-am43

the AM43 is already a built in option in ESP home

sambeetm commented 2 years ago

Thank you. Deleted those 2 lines. Its got compiled successfully and installed. Working as expected. !!

panoriega commented 2 years ago

I put a temp fix for current version using PubSubClient, this is not the best solution, I made this changes just for test purposes. Now it is able to subscribe and publish topics to mosquitto

I also tried to replace PubSubClient by MQTT 2.5. Both versions are on examples on my fork and in "working condition", if you want to try and share your comments about it.

https://github.com/panoriega/am43

Home Assistant 2022.4.0 Mosquitto broker addon 6.0.1

Thanks, Antonio

danilkorotkov commented 1 year ago

6.2.0 works perfect