AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.45k stars 342 forks source link

Question - how can one modify files on gateway filesystem through Telnet terminal #299

Closed samthesuperhero closed 2 years ago

samthesuperhero commented 3 years ago

Hi,

question - what is the best way if I want to modify scripts / configs inside the gateway?

just updated the firmware using mgl03_1.4.7_0115_mod20201222.uart, connected to it via Telnet,

and trying to find the way how to redirect miio_client to my private cloud to implement the protocol on my cloud, without a need to route the traffic from my cloud to local network address of gateway.

What I get whn I try to change configs in gateway filesystem is:

'/bin/daemon_miio.sh' Read-only file system

As I understand --host= --port= to my cloud endpoint should work!

Usage: miio_client
        [-D --daemonize]
        [-H --host=<host>] enture mutual exclusion with -C,you can only use -C or -H at the same time
        [-p --port=<port>]
        [-i --interval=<int> ms] set sync interval of _otc.info
        [-l --loglevel=<level>] set loglevel (0-4), less = more verbose
        [-L --logfile=file] output log into file instead of stdout
        [-s --logfile size] set log size n(1-1024) to limit logfile to nkB
        [-n --rpc num] set the max RPC session number(6-128) of miio_client processing
        [-d --datadir=<path>] set miio data dir path, ending with '/'
        [-e --enckey] key(s) are encrypted saved
        [-E --encdata] data communication are encrypted
        [-C --dcountry] set the country domain where the device locates in,ignore if it in China
        [-t --mjac-test] test mjac
        [-o --openfeatures] select the desired features
                            1. 'MSC' stands for security chip
                            2. 'FILE_STORE' represents the file system
        [-h --help]

any ideas?

Thank you!!

AlexxIT commented 3 years ago
  1. You may build your own firmware
  2. You can do things in /data/run.sh file (for custom fw only)
samthesuperhero commented 3 years ago

Hi @AlexxIT, thanks for answers!

Can you please advise where can I read about building my own firmware?

And what to put in the /data/run.sh to modify the miio_client command line parameters??

Thank you!

AlexxIT commented 3 years ago

I never build fw and don't have this instructions

niceboygithub commented 3 years ago

You can create a script '/data/scripts/startup.sh' which will be called while boot up. for example, here is my script

#!/bin/sh

telnetd_running=`pgrep telnetd`
if [ "x${telnetd_running}" == "x" ]; then telnetd; fi
startup.sh
echo enable > /sys/class/tty/tty/enable

You can reference startup.sh to create your own startup script. And remember to run telnetd and wifi_start.sh.

AlexxIT commented 2 years ago

I think the issue may be closed