// Notes: // - Device updates come from within the EweLinkAPI. The websocket receives a message // for a device. It then calls 'Update' on the device, which the Consumer observes. public Model() { ConsumersList = new ConsumerList(); Settings = new SettingsData(SettingsData.Filepath); Shutdown = new CancellationTokenSource(); History = new History(); Fronius = new FroniusAPI(Settings.SolarInverterIP, Shutdown.Token); Ewe = new EweLinkAPI(Shutdown.Token); Solar = new SolarData(); Sched = new Schedule(); Sched.Add(new Schedule.Range("Monitor Active", Schedule.ERepeat.Daily, new DateTimeOffset(1, 1, 1, 8, 0, 0, TimeSpan.Zero), new DateTimeOffset(1, 1, 1, 18, 0, 0, TimeSpan.Zero))); Log.Write(ELogLevel.Info, "Model initialised"); m_settings.NotifyAllSettingsChanged(); // Prevent system sleep WinOS.SystemSleep(keep_awake: true); }