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

viomi: Ensure timezone is UTC #732

Merged
merged 1 commit into from
Mar 4, 2021
Merged

Conversation

depau
Copy link
Contributor

@depau depau commented Mar 3, 2021

As discussed #728

Ensures Viomi is set to UTC after cloud is connected.

Question: should I also adjust DND and schedules to the new timezone? The vacuum doesn't do it on its own, and I can bet we'll see issues "valetudo messed up my schedules".

I decided to keep it simple for now.

@Hypfer
Copy link
Owner

Hypfer commented Mar 4, 2021

We may be able to achieve this outside of Valetudo.
It might be interesting to see what the set timezone command actually does on viomi.

On dreame, it just replaces the /etc/localtime symlink with the one of the selected timezone

Therefore, the script that runs valetudo currently contains this:

if [ ! "$(readlink /data/config/system/localtime)" -ef "/usr/share/zoneinfo/UTC" ]; then
        rm /data/config/system/localtime
        ln -s /usr/share/zoneinfo/UTC /data/config/system/localtime
fi

Maybe we could adapt something similar here?

@depau
Copy link
Contributor Author

depau commented Mar 4, 2021

On viomi, /etc/localtime is a broken symlink. It actually always keeps the system timezone set to Asia/Shanghai, but the time is consistent with the timezone you set from miIO.

Since it is based on OpenWRT, timezone configuration is performed via UCI and stored in /etc/config/system, which contains the following content:

config system
	option hostname	TinaLinux
	option timezone	Asia/Shanghai
	option timezone CST-8

config timeserver ntp
	list server ntp5.aliyun.com
	list server 0.openwrt.pool.ntp.org
	list server 0.cn.pool.ntp.org
	option enable 1
	option enable_server 0

And I notice it uses Chinese servers for NTP, which not only is bad due to the great firewall slowing things down, but there are also the usual "located in China" concerns. How about on Viomi we:

  • If embedded
    • Set the timezone first via UCI
    • Replace all NTP servers with pool.ntp.org ones
  • Finally set the the timezone via miio, regardless of embedded, to make sure RobotApp is aware of any changes and avoid inconsistencies.

I'm firing up ghidra to see how exactly RobotApp handles the timezone.

EDIT: it simply updates its own config file and internal status.

@Hypfer
Copy link
Owner

Hypfer commented Mar 4, 2021

Thank your for researching that.
Definitely something to come back to when we start building viomi images using the dustbuilder which will hopefully be very soon.

@forast3r
Copy link

forast3r commented Apr 4, 2021

Hi, is there a fix or some setting that has to be done manually on viomi to get rid of this error message? #799

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants