Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing firmware update via OTA #12

Open
esc247 opened this issue Jul 28, 2020 · 17 comments
Open

Testing firmware update via OTA #12

esc247 opened this issue Jul 28, 2020 · 17 comments

Comments

@esc247
Copy link

esc247 commented Jul 28, 2020

Hi,

I have been trying to use the OTA firmware update method, as I burnt off the soldering point on the board. I cannot understand what to do to try this.

I installed both miio and python-miio, extracted the token from the device, but not sure what command to use.

Any help will be greatly appreciated.

@roth-m
Copy link
Owner

roth-m commented Aug 3, 2020

In the README there is the miio command I believe should be sent. But sorry, I never took time to test it.

@esc247
Copy link
Author

esc247 commented Aug 3, 2020

I'm trying to test this, as I dont need the device (I got a CC2531). Happy to help test it if there was more info. I looked into the readme, but the command there doesnt work.

@roth-m
Copy link
Owner

roth-m commented Aug 12, 2020

Could you please try to issue a miIO.ota_install command after the miIO.ota '{"mode":"normal", "install":"1", "app_url":"#url#", "file_md5":"#file_md5#"}' ?

@moodyblue
Copy link

moodyblue commented Oct 11, 2020

Hi, I've bought a "Mi Smart Sensor Set" in a promo sometime ago. My plan was to use the sensors and trash the gateway, but then I saw this thread. So I've picked an old PC, installed Debian X86 on it, installed miiocli, and gave the following command:

hugo@debian:~$ miiocli device --ip 192.168.131.16 --token xxx info
Model: lumi.gateway.mieu01
Hardware version: Linux
Firmware version: 3.5.8_147
Network: {'localIp': '192.168.131.16', 'mask': '255.255.255.0', 'gw': '192.168.131.1'}
AP: {'ssid': 'Aveiro-Guest', 'bssid': '76:83:C2:9A:8B:04'}

This shows that miiocli is working, token is correct and my gateway is the mieu01 one. Then I gave the following command:

miiocli device --ip 192.168.131.16 --token xxx raw_command "miIO.ota \'{\"mode\":\"normal\", \"install\":\"1\", \"app_url\":\"https://github.com/roth-m/miioclient-mqtt/blob/master/firmware-mod/lummod_gw.bin\", \"file_md5\":\"525d3181fc3125eccb5e19540e8d771b\"}\'"

and waited some minutes. Then I've done a power recycle. Here's the situation now:

  1. My android phone, using the "Mi Home" app, has access to the gateway
  2. The gateway recognizes the sensors. I've tested one automation and it worked
  3. telnet service is not enabled in the gateway
  4. Command miiocli device --ip 192.168.131.16 --token xxx info no longer works (gives a timeout)

How to proceed from here ?

Edit: Looks like I've put a wrong md5 (got it from the description and not from the file itself), but apparently miiocli is no longer accessing the gateway (ping is ok)

@roth-m
Copy link
Owner

roth-m commented Oct 11, 2020

It looks like your gateway has changed its IP (dhcp) or token. Can you confirm by issuing a discover command?

@moodyblue
Copy link

moodyblue commented Oct 11, 2020

In Mi Home app IP and token did not change. I have put the IP and token in OpenHAB (Xiaomi Mi IO binding) and it goes to online. In theory that binding is also capable of sending commands to the gateway, so it's an alternative to miiocli, but I don't know how to do it.

@roth-m
Copy link
Owner

roth-m commented Oct 12, 2020

The Xiaomi Mi IO binding will not work as the protocol used by this gateway (MIOT which is using MIIO commands) is not yet implemented (I think as of September 2020).
The firmware mod will shutdown the original miio-client after 10 minutes (from restart).
Can you ping the gateway or connect to it using ssh?

@moodyblue
Copy link

Don't know why, but miiocli device --ip 192.168.131.16 --token xxx info works again. So I've enabled a web server to put file lummod_gw.bin and gave the miIO.ota command. Waited 30mins and then power recycle the Mi gateway.

Now I can ping it, but I have no telnet or ssh access to it. Does your app open any ports so that I can inspect with nmap ?

@roth-m
Copy link
Owner

roth-m commented Oct 13, 2020

In the http server logs, do you see any request for the lummod_gw.bin file? In other words, does the gateway fetches the package?

Yes, it enables the ssh server (dropbear). You should be able to issue: ssh root@gateway_ip and login using the password "admin".

@moodyblue
Copy link

moodyblue commented Oct 13, 2020

I need some time to investigate how to enable logging. I'm using a QNAP NAS with apache web server. apache log only contains boot messages. I'll try again in a few days.

@moodyblue
Copy link

moodyblue commented Oct 14, 2020

I've enabled apache log. It shows download requests from my PC but not from the Mi Gateway. From my PC I can download using url http://192.168.130.210:81/lummod_gw.bin

I'm not a linux expert, maybe the miIO.ota syntax is not correct.

@roth-m
Copy link
Owner

roth-m commented Oct 14, 2020

Could you please try to issue the following command?

miiocli device --ip 192.168.131.16 --token xxx raw_command "miIO.ota \'{\"mode\":\"normal\", \"install\":\"1\", \"app_url\":\"http://192.168.130.210:81/lummod_gw.bin\", \"file_md5\":\"525d3181fc3125eccb5e19540e8d771b\",\"proc\": \"dnld install\"}\'"

@moodyblue
Copy link

I've tried, but the same symptom: I have no log that gateway has attempted to download the firmware, but in order to continue to be able to send miiocli commands I need to power recycle the gateway. But even without power recycle the gw appears online in the Mi Home app.

@roth-m
Copy link
Owner

roth-m commented Oct 30, 2020

So there is a need for a correct command to be sent for the firmware to be updated.....

@esc247
Copy link
Author

esc247 commented Oct 30, 2020 via email

@roth-m
Copy link
Owner

roth-m commented Oct 30, 2020

Yeah I know. Sorry, I don't know any other way to update the firmware (trying to google around without succes).
Maybe try to issue a "miIO.get_ota_progress" command after the "miIO.ota" command ?!

@moodyblue
Copy link

I've tried several miiocli commands. info and some others are ok, but everything I try to run with raw_command produces a timeout and puts the gateway unavailable for a couple of minutes. Some even require a power recycle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants