Skip to content

Commit

Permalink
fix(vendor.viomi): Wait a few seconds after cloud connected before fi…
Browse files Browse the repository at this point in the history
…xing TZ (#736)

This avoids timeouts.
  • Loading branch information
depau committed Mar 4, 2021
1 parent bafa158 commit f9bfb00
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lib/robots/viomi/ViomiValetudoRobot.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,19 @@ class ViomiValetudoRobot extends MiioValetudoRobot {
onCloudConnected() {
super.onCloudConnected();

this.sendCommand("get_prop", ["timezone"]).then((res) => {
if (res.length > 0) {
const timezone = res[0];
if (timezone !== 0) {
// Set timezone to UTC
this.sendCommand("set_timezone", [0]).then(_ => {
});
setTimeout(() => {
this.sendCommand("get_prop", ["timezone"]).then((res) => {
if (res.length > 0) {
const timezone = res[0];
if (timezone !== 0) {
// Set timezone to UTC
this.sendCommand("set_timezone", [0]).then(_ => {
Logger.info("Viomi timezone adjusted to UTC");
});
}
}
}
});
});
}, 5000);
}

onMessage(msg) {
Expand Down

0 comments on commit f9bfb00

Please sign in to comment.