niceboygithub / AqaraGateway

Aqara Gateway/Hub integration for Home Assistant
513 stars 66 forks source link

G2H interation #52

Closed geldelo closed 2 years ago

geldelo commented 2 years ago

Hi. Thank you very much. I tried again the mcchas' method for G2H and this time I was able to connect (the problem was in the SD card, it had to be formatted to FAT32). Checked through Putty, connects.

Next, I installed your Aqara gateway integration and added G2H, but nothing appeared in the list of devices. The info "MQTT Connected" is empty. What's wrong?

2021-11-06 12:36:09 ERROR gateway Failed to connect to MQTT server 192.168.1.81 due to exception: [Errno 111] Connection refused 2021-11-06 12:36:09 DEBUG gateway 192.168.1.81: mosquitto is not running as public! 2021-11-06 12:36:10 DEBUG gateway 192.168.1.81: Can't get devices: Expecting value: line 1 column 1 (char 0) 2021-11-06 12:36:10 DEBUG gateway 192.168.1.81: Unsupported model: {'coordinator': 'lumi.0', 'did': '', 'model': '', 'mac': 'xxxxxxxxxxxxxxxxxxxxx', 'manufacturer': 'NXP', 'channel': 25, 'cloudLink': 0, 'debugStatus': 0, 'type': 'gateway'} 2021-11-06 12:45:22 ERROR gateway Failed to connect to MQTT server 192.168.1.81 due to exception: [Errno 111] Connection refused

niceboygithub commented 2 years ago

First. please print out the connect of /mnt/config/zigbee/device.info after telnet via putty.

cat /mnt/config/zigbee/device.info

Second, please execute mosquitto and get the logs

ps | grep mosquitto
mosquitto

To solve the problem, you may need to do factory reset and try again? The some files of your G2H may corrupt

MMMveasy commented 2 years ago

i have the same issue.

Device.info: # {"devInfo":[]}#
ps | grep mosquitto
  141 root      2048 S    /tmp/out/mosquitto
  322 root      1688 S    grep mosquitto
# mosquitto
1639247121: mosquitto version 1.6.10 starting
1639247121: Using default config.
1639247121: Opening ipv4 listen socket on port 1883.
1639247121: Binding listener to interface "lo".
1639247121: Error: Address already in use

HA LOG:

2021-12-11 19:24:15  ERROR  gateway  Failed to connect to MQTT server 192.168.1.200 due to exception: [Errno 111] Connection refused
 2021-12-11 19:25:17  DEBUG  gateway  192.168.1.200: Can't get devices: Expecting value: line 1 column 1 (char 0)

probably i need to switch mosquitto to public, but i don't know how. The variant "Not Flash Custom firmware method" fails first because of curl, a manual copy fails afterwards with pgrep not found..

anyone an idea ?

geldelo commented 2 years ago

First. please print out the connect of /mnt/config/zigbee/device.info after telnet via putty.

cat /mnt/config/zigbee/device.info

Second, please execute mosquitto and get the logs

ps | grep mosquitto
mosquitto

To solve the problem, you may need to do factory reset and try again? The some files of your G2H may corrupt

{"devInfo":[{"mac":"0xXXXXXXXXXXXXXX","shortId":"0x74cc","manuCode":"0x115f","model":"lumi.sensor_wleak.aq1","did":"lumi.158d0006b7a993","devType":0,"appVer":6,"hardVer":2,"devID":1026,"status":1,"model_ver":6,"preLeave":0},{"mac":"0xXXXXXXXXXXXXXX","shortId":"0xc966","manuCode":"0x115f","model":"lumi.vibration.aq1","did":"lumi.158d0006d0c40d","devType":0,"appVer":8,"hardVer":3,"devID":0,"status":1,"model_ver":8,"preLeave":0}]}#

146 root 2048 S /tmp/out/mosquitto 889 root 1688 S grep mosquitto

1640416846: mosquitto version 1.6.10 starting 1640416846: Using default config. 1640416846: Opening ipv4 listen socket on port 1883. 1640416846: Binding listener to interface "lo". 1640416846: Error: Address already in use

Aqara Gateway Debug log: 2021-12-25 10:17:29 DEBUG main SysInfo: {'installation_type': 'Home Assistant Supervised', 'version': '2021.12.5', 'dev': False, 'hassio': True, 'virtualenv': False, 'python_version': '3.9.7', 'docker': True, 'arch': 'x86_64', 'os_name': 'Linux', 'os_version': '4.19.0-18-amd64', 'user': 'root', 'supervisor': '2021.12.2', 'host_os': 'Debian GNU/Linux 10 (buster)', 'docker_version': '20.10.12', 'chassis': 'desktop'} 2021-12-25 10:17:29 ERROR gateway Failed to connect to MQTT server 192.168.1.150 due to exception: [Errno 111] Connection refused 2021-12-25 10:18:30 DEBUG gateway 192.168.1.150: Can't get devices: Expecting value: line 1 column 1 (char 0)

geldelo commented 2 years ago

The problem still hasn't been resolved

niceboygithub commented 2 years ago

try to add the command to /etc/init.d/S90app after '/etc/tar_app.sh"

cp /data/bin/mosquitto /tmp/out
geldelo commented 2 years ago

try to add the command to /etc/init.d/S90app after '/etc/tar_app.sh"

cp /data/bin/mosquitto /tmp/out

ERROR gateway Failed to connect to MQTT server 192.168.1.150 due to exception: [Errno 111] Connection refused

niceboygithub commented 2 years ago

Make sure that you put the public mosquitto to /data/bin/ and old mosquitto was killed.

geldelo commented 2 years ago

Thx, now it works.

geldelo commented 2 years ago

Can you please tell me if there is a wiki for this integration where I can find how to manage this gateway (commands), for example, execute play_ringtone on it and more?

kizimenko commented 2 years ago

@geldelo

I have the same problem but after all the steps nothing changes. Can you write step by step what what did?

# vi /etc/init.d/S90app
#  ps | grep mosquitto
  143 root      2048 S    /tmp/out/mosquitto
  279 root      1688 S    grep mosquitto
# mosquitto
1642877853: mosquitto version 1.6.10 starting
1642877853: Using default config.
1642877853: Opening ipv4 listen socket on port 1883.
1642877853: Error: Address already in use
# 
geldelo commented 2 years ago

I deleted the old /data/bin/mosquitto and followed the instructions:

mkdir /data/bin
cd /data/bin
wget -O /tmp/curl "http://master.dl.sourceforge.net/project/aqarahub/binutils/curl?viasf=1"; chmod +x /tmp/curl
/tmp/curl -s -k -L -o /data/bin/mosquitto https://raw.githubusercontent.com/niceboygithub/AqaraCameraHubfw/main/binutils/mosquitto; chmod a+x /data/bin/mosquitto

If an error occurs during installation, you need to download curl to another folder where there is free space.

bubez81 commented 2 years ago

strange I did all the steps but I always get: # mosquitto 1646234190: mosquitto version 1.6.10 starting 1646234190: Using default config. 1646234190: Opening ipv4 listen socket on port 1883. 1646234190: Error: Address already in use

plesetsk commented 2 years ago

Hi! I have the same problem

`# ps | grep mosquitto 141 root 2048 S /tmp/out/mosquitto 259 root 1688 S grep mosquitto

mosquitto

1658214617: mosquitto version 1.6.10 starting 1658214617: Using default config. 1658214617: Opening ipv4 listen socket on port 1883. 1658214617: Binding listener to interface "lo". 1658214617: Error: Address already in use`

Tried to

rm /data/bin/mosquitto
rm /tmp/out/mosquitto

and reinstall

wget -O /tmp/curl "http://master.dl.sourceforge.net/project/aqarahub/binutils/curl?viasf=1"; chmod +x /tmp/curl /tmp/curl -s -k -L -o /data/bin/mosquitto https://raw.githubusercontent.com/niceboygithub/AqaraCameraHubfw/main/binutils/mosquitto; chmod a+x /data/bin/mosquitto

What else I can do to connect AqaraGateway?

Thanks

plesetsk commented 2 years ago

solution in #105