depends on the platform - on my virtenv direct install on ubuntu, there is a bucket load of extra logging in /var/log/syslog that I dont get in the homeassistant.log
walaj@JonLabNUC:/home/homeassistant/.homeassistant/automations$ cat /var/log/syslog|grep hass|tail -10
May 30 18:12:55 JonLabNUC hass[14441]: 2019-05-30 18:12:55 INFO (MainThread) [homeassistant.helpers.script] Script battery_sensor_from_attributes: Running script
May 30 18:12:55 JonLabNUC hass[14441]: 2019-05-30 18:12:55 INFO (MainThread) [homeassistant.helpers.script] Script battery_sensor_from_attributes: Executing step call service
May 30 18:12:55 JonLabNUC hass[14441]: 2019-05-30 18:12:55 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor plug_158d0002431039_battery, sending update
May 30 18:12:55 JonLabNUC hass[14441]: 2019-05-30 18:12:55 INFO (MainThread) [homeassistant.helpers.script] Script battery_sensor_from_attributes: Executing step call service
May 30 18:12:55 JonLabNUC hass[14441]: 2019-05-30 18:12:55 INFO (MainThread) [homeassistant.components.mqtt] Got update for entity with hash: ('sensor', 'plug_158d0002431039_battery') '{'name': 'WashingMachine Battery', 'state_topic': 'homeassistant/sensor/plug_158d0002431039_battery/state', 'value_template': '{{ value_json.value | int }}', 'unit_of_measurement': '%', 'device_class': 'battery', 'unique_id': 'plug_158d0002431039_battery', 'json_attributes_topic': 'homeassistant/sensor/plug_158d0002431039_battery/attributes', 'platform': 'mqtt', 'discovery_hash': ('sensor', 'plug_158d0002431039_battery')}'
May 30 18:12:55 JonLabNUC hass[14441]: 2019-05-30 18:12:55 INFO (MainThread) [homeassistant.components.mqtt] Updating component: sensor.washingmachine_battery
May 30 18:12:55 JonLabNUC hass[14441]: 2019-05-30 18:12:55 INFO (MainThread) [homeassistant.helpers.script] Script battery_sensor_from_attributes: Executing step call service
May 30 18:13:00 JonLabNUC hass[14441]: 2019-05-30 18:13:00 INFO (MainThread) [homeassistant.components.automation] Executing update_battery_status_group_members
May 30 18:13:00 JonLabNUC hass[14441]: 2019-05-30 18:13:00 INFO (MainThread) [homeassistant.helpers.script] Script update_battery_status_group_members: Running script
May 30 18:13:00 JonLabNUC hass[14441]: 2019-05-30 18:13:00 INFO (MainThread) [homeassistant.helpers.script] Script update_battery_status_group_members: Executing step call service
Probably not relevant since you’ve commented it out, but if it’s not commented out in your actual config then you have a dash before the “mac” part of your config.
My own aqara config looks as below (not real MAC values):
Is the MAC only required if you have multiple gateways?
Also might be no harm to double check the MAC value on the gateway itself and in ubiquiti. I could swear I’ve seen the MAC change for some chinese devices when I’ve hard reset them.
EDIT: also you have Xiaomi spelt incorrectly in your reference to your secrets file; is this the same spelling in the actual secrets file as well? Could be you’re not providing a valid key at all.
Thanks. I’ve tried adding all those (and fixing my spelling mistake) along with a retry at 25 but still not working even though I can ping the Aqara gateway. I’m going to try and downgrade my entire UniFi network even though it was working yesterday morning with the current firmware before I hard reset the Aqara. There is a bit of chatter on the UniFi forums about 4.0.42.10433 so I’ll give that a go.
Downgraded all wireless and switches, still no go. Tried every combination of key, mac, host without success. Can ping gateway and control it from Mi Home App. Re-generated api key several times in app, updated config and restarted, still no go. Lost now.
I’ve now ordered a Conbee II from Amazon so I’ll be offline with 30 odd sensors for 2 weeks while I await its arrival. Be nice not to have to rely on the Xiaomi Hub.
Yep, it seems the gateway reset has screwed it up. In my efforts to get it talking to the Mi Home app which wasn’t really necessary now that I think about it, HA will no longer talk to it. I even sparked up another HA instance on a Pi to test and that couldn’t see it either. Lesson learnt. If it ain’t broke…
I’ll switch to Deconz and see if that is a better long-term solution.
Nope, nothing useful when I changed the log to debug. I had the same issue with non-visibility of the xiaomi hub when I tried installing HA in Docker on my NAS many months ago. It’s the reason I gave up with Docker for HA and Node Red.
I’m now running HassOS on NUC i3 and apart from this (not so little) issue today, it’s been rock solid.
SOLVED! Turns out an update effects the gateway when it’s reset or something along those lines and the UDP ports required for HA access get closed.
From a Linux machine on the network, run this command.
sudo nmap -sU 192.168.xx.xx -p 9898,4321
If both ports say closed, you have to crack the unit open, solder three wires and connect a serial converter to send it a command via PuTTy. Fortunately I’m a hardware guy and I’ve flashed many Sonoff’s and other devices so I’m well versed at this.
There is also another HA thread with tons of information on this issue here.
Once done, you should get the following back:
pi@pi-plantgateway:~ $ sudo nmap -sU 10.0.1.20 -p 9898,4321
Starting Nmap 7.40 ( https://nmap.org ) at 2019-06-01 23:34 NZST
Nmap scan report for 10.0.1.20
Host is up (-0.12s latency).
PORT STATE SERVICE
4321/udp open|filtered rwhois
9898/udp open monkeycom
MAC Address: 34:CE:00:00:00:00 (Unknown)
Glad you got it sorted. So resetting your hub switched off the developer mode, and when enabling developer mode again the firmware bug was preventing the ports from being opened? I had thought that developer mode was persistent across a reset, so that’s a bummer.
I’ll have to keep the SSID of my network the same so I don’t ever have to reset the device… Although I’ve soldered and flashed sonoffs, my actual soldering skills aren’t that great and I don’t like the idea of connecting a mains-powered device to my laptop USB port.
I lost track as I reset the damn Aqara gateway so many times trying to get it working. I had two issues.
After resetting, I could not get the gateway to appear in the mi Home app even though it was actually connected to my network. This was DNS related and your DNS should ideally be 8.8.8.8 when joining the gateway to the app.
My 2nd issue was lack of visibility to HA which turns out to be blocked port so after one of the resets, the ports got blocked and I didn’t realise.
A simply soft 5s soft network reset may not result in the problems I encountered?
N.B As a side note, my colours on my gateway light are now back to front after the reset. Red is Blue and vice versa so something went screwy.
I rebuilt my Home Assistant server in an attempt to resolve some folder and file permission errors as well as cleaning up old code. I followed a different guide than the one I had used before. I could see the gateway, I could turn the light on and off, and my temperature and door sensors would read at startup, but then refuse to update.
The solution was my Docker-compose YAML file.
My old config had