niceboygithub / AqaraGateway

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

G2H MQTT not connected #171

Closed clearwhitesky closed 7 months ago

clearwhitesky commented 1 year ago

Hi,

I have a Aqara G2H (ZNSXJ12LM) and I have opened up the telnet by carrying out the SDcard method.

I have successfully added it into my HA.

I have paired an Aqara Temperature and Humidity Sensor (WSDCGQ11LM) to this camera through the Aqara Home app and this device was shown in my HA.

But strangely I don't get any reading in HA, it has been showing unavailable for all parameter (Battery, Temperature, Humidity, Pressure)

I process to enable the Public MQTT through Telnet

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

and it still doesn't work.

When I look into my HA > System information

Aqara Gateway Telnet Connected 10.0.80.183 MQTT Connected

I notice that the MQTT is not connected.

I look into my log and there is a error

Failed to connect to MQTT server 10.0.80.183 due to exception: [Errno 111] Connection refused 4:02:19 PM – (ERROR) Aqara Gateway (custom integration)

I am stuck here, do I need to connect a USB cable from my HA to my G2H and create a USB connection to MQTT broker or Mosquitto broker?

My purpose is to use G2H as a zigbee hub so I can make use of all my other zigbee devices locally. Anyone have experience working with G2H?

Thank you.

niceboygithub commented 1 year ago

it still doesn't work.

What you mean that doesn't work? What is the error logs?

I am stuck here, do I need to connect a USB cable from my HA to my G2H and create a USB connection to MQTT broker or Mosquitto broker

It doesn't need to use USB cable.

My purpose is to use G2H as a zigbee hub so I can make use of all my other zigbee devices locally.

Try to telnet to G2H. and use the following command to have a try.

killall -9 mosquitto; /data/bin/mosquitto -d
clearwhitesky commented 1 year ago

Thanks for replying

Your suggestion works! Thanks! One more question, on average I get the reading like every few minutes (~4-5 mins) is there a way to get the reading faster? Like every 10 or 30 sec?

I need it because I require precision control to automate some tasks.

So far out of so many temperature and humidity sensors, I have brought and tested, the old Xiaomi temperature/humidity sensor 1st generation (LYWSDCGQ) fits my requirement. They have a very fast update interval every < 10 sec and they run on an AAA battery which means they can last longer as compared to all newer sensors that run on a button battery. Too bad now it's difficult to buy them. I think they stopped producing them and maybe it's because they don't run on encryption.

Excusing the command in telnet

killall -9 mosquitto; /data/bin/mosquitto -d

Untitled

and now my telnet is connected as shown in HA system information

Screenshot 2023-03-07 at 11 24 18 AM

and after waiting for a while, the reading is coming in now

Screenshot 2023-03-07 at 11 34 47 AM
oreshkin75 commented 1 year ago

Try to telnet to G2H. and use the following command to have a try.

killall -9 mosquitto; /data/bin/mosquitto -d

i get

/data/bin/mosquitto: /lib/libm.so.6: version GLIBC_2.29 not found (required by /data/bin/mosquitto) /data/bin/mosquitto: /lib/libc.so.6: version GLIBC_2.25 not found (required by /data/bin/mosquitto) /data/bin/mosquitto: /lib/libc.so.6: version GLIBC_2.28 not found (required by /data/bin/mosquitto)

guidogoni commented 1 year ago

it still doesn't work.

What you mean that doesn't work? What is the error logs?

I am stuck here, do I need to connect a USB cable from my HA to my G2H and create a USB connection to MQTT broker or Mosquitto broker

It doesn't need to use USB cable.

My purpose is to use G2H as a zigbee hub so I can make use of all my other zigbee devices locally.

Try to telnet to G2H. and use the following command to have a try.

killall -9 mosquitto; /data/bin/mosquitto -d

Thanks for the insight, it's working great as mentioned before but as soon as the camera reboots (power failure) I have to repeat the same command.

I checked what mosquitto is running on boot and its: 141 root 2048 S /tmp/out/mosquitto

After I run the command its: 258 root 2052 S /data/bin/mosquitto -d

Is there any way we can replace from where the /tmp/out is getting pulled from or change the original file?

guidogoni commented 1 year ago

it still doesn't work.

What you mean that doesn't work? What is the error logs?

I am stuck here, do I need to connect a USB cable from my HA to my G2H and create a USB connection to MQTT broker or Mosquitto broker

It doesn't need to use USB cable.

My purpose is to use G2H as a zigbee hub so I can make use of all my other zigbee devices locally.

Try to telnet to G2H. and use the following command to have a try.

killall -9 mosquitto; /data/bin/mosquitto -d

Thanks for the insight, it's working great as mentioned before but as soon as the camera reboots (power failure) I have to repeat the same command.

I checked what mosquitto is running on boot and its: 141 root 2048 S /tmp/out/mosquitto

After I run the command its: 258 root 2052 S /data/bin/mosquitto -d

Is there any way we can replace from where the /tmp/out is getting pulled from or change the original file?

OK I've been reading g2h-camera-mods README to better understand how some things are working.

Modified normal.xml and changed entry <process name="/tmp/out/mosquitto"> to <process name="/data/bin/mosquitto">

Now everything works after reboot! Thanks for all the info available.

Silverow commented 11 months ago

Try to telnet to G2H. and use the following command to have a try.

killall -9 mosquitto; /data/bin/mosquitto -d

i get

/data/bin/mosquitto: /lib/libm.so.6: version GLIBC_2.29 not found (required by /data/bin/mosquitto) /data/bin/mosquitto: /lib/libc.so.6: version GLIBC_2.25 not found (required by /data/bin/mosquitto) /data/bin/mosquitto: /lib/libc.so.6: version GLIBC_2.28 not found (required by /data/bin/mosquitto)

I got the same result. What can be done about it?