Xiaomi Gate Way - error getting token - devices online

So I’ve just got a new gateway.

I’ve added it via manual things The dev key I think I have right. The Serial number I can only see one in the app, an 8 digit number.

Bridge mihome:bridge:9999999 "Xiaomi Gateway" [ serialNumber="9999999", ipAddress="", port=9898, key="mykey", pollingInterval=6000 ] {
    Thing mihome:gateway:9999999"Xiaomi Mi Smart Home Gateway" [itemId="9999999"]

It my serial number, the bridge id number and the item id of the gateway all suuposed to be the same 8 digit number? As for me they are.

I can’t seem to automatically find…but that will be network. I run a Ubiquiti USG, and their APs also. I’ve put this device on an IOT network, but have allowed port 9898 both ways in udp. And the ip address of the gateway is what in in the thing definition. Openhab is running on a different subnet, but there is routing between the two.

Both the bridge and gateway show as online.

But when switching a light I see the following:

21:50:33.210 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Device 999999 on channel mihome:gateway:999999 :brightness received command OFF
21:50:33.220 [INFO ] [smarthome.event.ItemStateChangedEvent] - mihome_gateway_lightswitch changed from ON to OFF
21:50:33.223 [WARN ] [ng.mihome.handler.XiaomiBridgeHandler] - No token received from the gateway yet. Unable to encrypt the access key.
21:50:33.231 [DEBUG] [ng.mihome.handler.XiaomiBridgeHandler] - Send to bridge mihome:bridge:999999 : {"cmd": "write", "model": "gateway", "sid": "999999", "short_id": "0", "data": "{\"rgb\": 16580604, \"key\": \""}"}
21:50:33.238 [TRACE] [g.mihome.internal.socket.XiaomiSocket] - Sending message: {"cmd": "write", "model": "gateway", "sid": "999999 ", "short_id": "0", "data": "{\"rgb\": 16580604, \"key\": \""}"} to /
21:50:33.246 [DEBUG] [ome.handler.XiaomiActorGatewayHandler] - Update OFF for channel mihome:gateway:999999 :brightness received
21:50:33.248 [DEBUG] [g.mihome.internal.socket.XiaomiSocket] - Received Datagram from on Port 9898
21:50:33.252 [TRACE] [ng.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"write_ack","sid":"999999 ","data":"{\"error\":\"No device\"}"}
21:50:33.256 [TRACE] [ng.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 87296016
21:50:33.260 [DEBUG] [ng.mihome.handler.XiaomiBridgeHandler] - Device 999999 honored write request
21:50:33.264 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"write_ack","sid":"999999 ","data":"{\"error\":\"No device\"}"}
21:50:33.268 [TRACE] [g.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners
21:50:33.271 [TRACE] [g.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-782,5,main] waiting for data on port 9898

Any ideas? Do I have one of the values wrong?