I get the IP of the socket, connecting to it while in connecting mode with my Wifi, after connected it assigned to my PC 19.168.4.2, and the gateway IP is 192.168.4.1. Is that correct?
Then is used the packet sender to 192.168.4.1 and the socket responded me and i get the Token.
Timeouts usually indicate an incorrect token; you need to extract the token after you have bound it with the app. If I’m understanding it correctly, you are not using the sockets address for host, but that of the gateway…?
What i’m trying to do, is to connect the wifi plug for “first time” directly to my wifi network using HA. Without using the Xiaomi Gateway or Mi Home app. I think this is the first question, is this possible?
So that means when the device is in pairing mode, i must be able to find the device from HA and tell the device the Wifi password so he can leave the pairing mode and connect to the network.
EDIT: Ok so i connected the device to network using Mi Home APP, and it looks it connects directly to wifi, it’s not using Gateway, thats good.
Now i’m only getting this error:
I think he discovered the device but is some problem with xiaomi_miio.py. My wifi socket is the most new one, maybe it’s not compatible?
Here talk about the models (chuangmi.plug.m1, chuangmi.plug.v1…), but i don’t know how to identify my own device model (the only model number i can read: ZNCZ04CM).
That should actually work, but is not recommended as anyone in rangeis able to connect to your switch when it is unprovisioned.
Setting up the pairing inside homassistant is not supported currently, and that wouldn’t work with most of the devices as they reset the token during the pairing process.
How did you obtain the token? With help of Xiaomi Miio - Home Assistant ? You could check your homeassistant logs to see the real error message, maybe it is a timeout (most likely related to invalid token), but maybe there is something else.
You could also try to install python-miio manually and command the switch with miplug command in console to test the connectivity:
miplug discover
should detect the device, and potentially reveal the token (if it’s not only fs or 0s, it should be the real token). Otherwise you simply use
miplug -d --ip <ip address> --token <token> status
to see if it works. You can get the name of the model among other information with
miplug raw-command miIO.info
Hope this helps you further, please let me know how it goes!
Thanks for the answer. The problem was the Token. The Token that i get from Packet sender, wasn’t the correct. I can get the Smarthome/log file from Mi Home App. And there i find the model (chuangmi.plug.m3) and the correct token. Once updated the Toaken, i can find the Plug.
The IP wasn’t corrent too, i get that IP wwhen in pairing mode, but once i connect the device to wifi (via Mi Home APP), i get the assigned IP by router.
I’m not at home right now, but i want to try to remove the plug from the Mi Home app and see if it still works on HA. I don’t know xD i just don’t want to use the thousands of brands apps (xiaomi, broadlink, yeelight, phillips,…) for each device, and connect them to the same “APP” (HA).
Well in any case this thread is solved! thanks!
EDIT: I removed the device from the Mi Home APP, and HA lost the device too. Because the device go back to pairing state… This is wat i want to avoid.