private void UpdateVariables(DaylightDevice device)
        {
            var time = DateTime.UtcNow.AddMinutes(device.OffsetInMinutes).TimeOfDay;
            var sunrise = SunsetCalculator.GetSunrise(device.Latitude, device.Longitude);
            var sunset = SunsetCalculator.GetSunset(device.Latitude, device.Longitude);

            device.IsDaylight = time >= sunrise && time <= sunset;
            _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "IsDaylight", device.IsDaylight));

            var offset = DateTime.UtcNow - DateTime.Now;
            _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "Sunrise", (sunrise - offset).ToString("hh\\:mm\\:ss")));
            _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "Sunset", (sunset - offset).ToString("hh\\:mm\\:ss")));
        }
        private void UpdateVariables(DaylightDevice device)
        {
            var time    = DateTime.UtcNow.AddMinutes(device.OffsetInMinutes).TimeOfDay;
            var sunrise = SunsetCalculator.GetSunrise(device.Latitude, device.Longitude);
            var sunset  = SunsetCalculator.GetSunset(device.Latitude, device.Longitude);

            device.IsDaylight = time >= sunrise && time <= sunset;
            _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "IsDaylight", device.IsDaylight));

            var offset = DateTime.UtcNow - DateTime.Now;

            _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "Sunrise", (sunrise - offset).ToString("hh\\:mm\\:ss")));
            _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "Sunset", (sunset - offset).ToString("hh\\:mm\\:ss")));
        }
 public DaylightScriptObject(DaylightDevice device)
 {
     _device = device;
 }
 public DaylightScriptObject(DaylightDevice device)
 {
     _device = device;
 }