virtualzone/landroid-bridge

Appling schedule is incorrect

Opened this issue · 4 comments

I was wondering often, why the schedule in the Landroid APP and the schedule in landroid bridge do not match. Now I had some time to verify in depth.

With a fresh clone the following happens on appling the schedule:
For every day the schedule shall be applied, the whole schedule is sent to the cloud. I my opinion this happens becaus of (LandroidS.ts :: 66-67):
message[weekday] = this.timePeriodToCloudArray(timePeriod);
this.log.info("Setting new schedule with update for weekday %d to %s", weekday, JSON.stringify(message));

So for everyday the whole schedule is applied. One can see that very nice then the server is run directly in a command line window: for everyday the whole message content is sent.
Changing the last line to JSON.stringify(message[weekday]) works out.

Second: The last applied day is day 7 as by Scheduler.ts :: 38:
if (i <= 7) {
That repeats that loop for 8 times: 0, 1, .... 6, 7. But the 7th day (countet from zero) equals the first. So always the current day is overwritten.

When applying that changes for me it works out.

I also run into this issue, see #60 and #67.

In deed this is part of your problem.
Though this fix does not apply all days in only one request, but still for every day one. If anybody is more common in landroid bridge I would also appreciate to apply the whole schedule in only one request.

Ok, this issue seems to be a bit more complicated.

  1. many times the schedule view on the webUI is corrupted: around the current time (+/- 1 hour) two values are given for the same time. They are shown below each other.
    This seems to be an issue matching todays forecast and todays history data. In my opinion this also might break the schedule calculation.
  2. Then uploading the schedule (I did it manually by the given command) only one days schedule gets updated.
    I think the reason is, that after sending one days data to the cloud, the values locally do not get updated. That leads to the fact, that only one value gets updated per run. The next cloud request updates the local data and overtakes the changes made by the last update. On the next update to the cloud the next day-schedule gets updated.
    This can be easily shown by disabling all schedule by the app and applying the schedule by the given command (readMe).

Regarding my first post: the shown "fix" does not work and only changes the log-output. For me the whole update procedure should be fixed in depth. The current way is inconsistent (posting an update for every day, but not requesting the current data from the cloud after the first update)

I hope anyone is able to improve the script. I really like it but in the current state it is not reliable.

I have to correct myself:
On comparing the weather provider wunderground and darksky I realized in the darksky implementation one line cutting double values was missing (compare WeatherDarkSky.ts::165 and WeatherWunderground.ts::180 ; this.removeDuplicateHourValues(finalResult); is missing for darksky). After adding that line it is working flawlessly since 2 weeks.
Before I sometimes saw 2 values for the same period. In that case the schedule calculation also failed for that day and the mower didn't move.