Skip to content

Instantly share code, notes, and snippets.

@WMP
Last active September 22, 2023 01:04
Show Gist options
  • Save WMP/53cd5c2697fdcf37ab534f37994b7062 to your computer and use it in GitHub Desktop.
Save WMP/53cd5c2697fdcf37ab534f37994b7062 to your computer and use it in GitHub Desktop.
To communicate with your AC over LAN network without connection to internet you need:
https://github.com/kueblc/midea-msmart/tree/support-8370
In example.py fill:
device = ac('YOUR_AC_IP', YOUR_AC_ID)
device.authenticate('YOUR_AC_MAC', 'YOUR_SSID', 'YOUR_WIFI_PW')
Then you must run this code on something computer:
#!/usr/bin/python3
import socket
import os
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
sock.bind(('SOMETHING_SERVER_IP', 443))
sock.listen(5)
while True:
connection,address = sock.accept()
buf = connection.recv(1024)
connection.send(buf)
This code make very stupid emulate of midea server, and is needed to your WiFi AC module dont restart if it cannot connect to module.appsmb.com:443
Next you must set on your router DNS entry, for example on OpenWRT:
Add to /etc/config/dhcp:
config dnsmasq
list addnhosts '/etc/hosts_my'
In /etc/hosts_my:
SOMETHING_SERVER_IP module.appsmb.com
Then /etc/init.d/dnsmasq restart
With this method your AC dont reboot with renew DHCP lease, and can answer for authorization code. Unfurtunatellu, still restarting one time on 10m
@saschaludwig
Copy link

I suggest using
#!/usr/bin/env python3
for shebang, as python isn't always installed in /usr/bin/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment