AM43 blinds control through MQTT

Maybe 10-15ft. I’ll try dropping another rPI and move them around. Thanks.

10-15 ft should work when there are no obstructions in between. At my place it’s the same distance. Rebooting Rpi is sometimes also a solution.

If not working: Also check your version of bluetooth within the os. The os packaging system mostly contains a pretty old version of bluez, while there are still some possibly relevant issues fixed. You can check version by performing β€˜bluetoothctl -v’. Upgrade instructions: https://github.com/zewelor/bt-mqtt-gateway/wiki/Upgrade-Bluez-on-Raspbian
Last version at time of writing this: 5.54
I’m currently running it on Rpi3B+, raspbian stretch with bluez 5.52.

Awesome! Thanks, upgrading now :slight_smile:

Could I please get some help with the proper syntax when entering the mqtt details and mac addresses?
these does does not seem to work:
sudo ./am43ctrl --url 192.168.2.24
sudo ./am43ctrl 02:87:4F:1D:A4:97

sudo ./am43ctrl MAC1 MAC2 -l 3001 -d --url mqtt://IPBROKER -u brokeruser -p brokerpass

Mac address in lowercase without :
eg. 02874f1da497

Thanks very much for your immediate help !
I think i’m getting somewhere. My broker pass contains brackets at the beginning and at the end.
Is this the correct syntax?
sudo ./am43ctrl -p β€˜(123456778)’

Password normally not between quotes.

My mqtt password is (1234). And this what I get in respons:

pi@raspberrypi:~/node_modules/.bin $ sudo ./am43ctrl -p (1234)
bash: syntax error near unexpected token `(’
pi@raspberrypi:~/node_modules/.bin $

Sending with quotes or double quotes does not return any errors, but I’m unsure if accepted by am43ctrl.

Thanks very much, I’ve got it working now !
Awesome !

Is there any way to keep am43ctrl alive without leaving the Terminal open?
How to start am43ctrl automatically if RPi re-boots?

Could I please get some help with making am43 ctrl persistent after reboot?
Which file(s) do I need to start with pm2 start ?

sudo pm2 start path_to_am43ctrl/node_modules/.bin/am43ctrl -- MAC1 MAC2 -l 3001 -d --url mqtt://IPBROKER -u brokeruser -p brokerpass

sudo pm2 save

I’m not sure what is going wrong here but the process seems to be running and not found at the same time:

pi@raspberrypi:~ $ sudo pm2 start node_modules/.bin/am43ctrl – 02bd8eb058b1 02cc5aa4e276 02874f1da497 -l 3001 -d --url mqtt://192.****** -u **** -p ****
[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /home/pi/node_modules/.bin/am43ctrl in fork_mode (1 instance)
[PM2] Done.
β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ id β”‚ name β”‚ mode β”‚ β†Ί β”‚ status β”‚ cpu β”‚ memory β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 0 β”‚ am43ctrl β”‚ fork β”‚ 0 β”‚ online β”‚ 0% β”‚ 21.5mb β”‚
β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
pi@raspberrypi:~ $ sudo pm2 save
[PM2] Saving current process list…
[PM2] Successfully saved in /root/.pm2/dump.pm2
pi@raspberrypi:~ $ pm2 list
β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ id β”‚ name β”‚ mode β”‚ β†Ί β”‚ status β”‚ cpu β”‚ memory β”‚
β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
pi@raspberrypi:~ $

And at restart am43ctrl is not running.

I got a couple of these blind motors recently and took a stab at implementing an MQTT gateway using an ESP32’s built in BLE controller.

I have been quite successful, and my ESP32 scans for, connects to, and exposes monitoring and control functionality for both my motors over MQTT. It integrates well with HA.

Sound like an interesting idea. Does it read the light sensor data too?

It does now, I just submitted an update.

Thanks a lot! I cannot wait for my board to come in. I’ll let you know …

My Home Assistant setup requires MQTT password and I did not find option for this entry in the config file. How do you handle the MQTT password ?

You can also launch it using native systemd:

  • create file am43ctrl.service in /etc/systemd/system :
[Unit]
Description=AM43-ctrl
After=multi-user.target

[Service]
ExecStart=/AM43DIRECTORY/node_modules/.bin/am43ctrl MAC1 MAC12 -l 3001 -d --url mqtt://BROKERIP -u BROKERUSER -p BROKERPASS -d
Restart=always
User=root
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/AM43DIRECTORY

[Install]
WantedBy=multi-user.target
  • sudo systemctl daemon-reload
  • sudo systemctl enable am43ctrl
  • sudo systemctl start am43ctrl

You can obtain logging through sudo journalctl -u am43ctrl.service