Sunrise-Sunset and Calendar functions for edge

Bingo. That did it. Thanks.

1 Like

So far the Sunrise/Sunset time has not changed at all since Saturday the day I installed the Virtual Calendar Device. I’ve pulled to refresh, and it doesn’t change it. The history of the device only shows entries from Saturday.

Hi @DaWeav,

Is the time shown in the details view correct?
The sunrise and sunset are wrong?
The subirse and sunset offsets change every minute?

If the time is correct, the driver timer has not stopped.

It might have been stopped by a hub reboot or driver update, but it should restart automatically.

The sunrise and sunset calculation refreshes it every hour on the dot 3 times in 3 minutes, so as not to waste hub cycles. If the calculation has not changed, it is not seen in the history, you can see it in the log with the CLI.

In history only events are shown in which there is any change

On the dates that we are, the time of sunrise or sunset changes 1 minute every two or three days, they rarely change both on the same day.

You can check the calculations with a weather web

If they are not correct I will look to see if there is an error in the driver

FYI - sunrise and sunset times are correct on my Installation.

1 Like

I have no problems either. All looks good so far. Although I have used this device about a day now.

1 Like

As @DaWeav idea and @milandjurovic71 request I have modified the Virtual Calendar Mc driver to adjust the local time offset with UTC from a custom capability.

In this way you can make an automation to change from summer to winter time and vice versa.

As it has a new capability, the current offset value is lost and therefore I will not update it automatically since the local time offset would be set to 0. and would cause the automations made to fail.

Therefore the current version will be renamed -(OLD) and the new driver version 2 as Virtual Calendar Mc.

You can make a manual update with the driver change in the App when it suits you best. You will have to enter your offset again with the UTC time. The rest of the data latitude, longitude and automations will not be lost or modified

New driver version

┌─────────────┬──────────────────────────────────────┐
│ Name        │ Virtual Calendar Mc                  │
│ Package Key │ virtual-calendar-v2                  │
│ Version     │ 2022-06-14T16:08:23.282538451        │
└─────────────┴──────────────────────────────────────┘

@DaWeav I changed too one thing that improves the periodic updating of the sunrise and sunset calculations

When I switch to this new version (which I confirm by going back in to Driver to check and the time is resetting based on 0 offset) I am not seeing the new offset option show up and the old one under settings remains …

Did you close the app and clear the cache di is Android?

I have force closed the app.

I’m on iOS so no clear cache option.

I don’t understand what is happening, could you reboot the hub from the IDE.

Too many strange things I’ve been seeing for a few days!

@Mariano_Colmenarejo i don’t see change too. I have latest driver installed


Also there is no Virtual Calendar in THEN part of Routines

@Nezmo, @milandjurovic71,
The driver change method may not work for these virtual devices.

Try add new device and search nearby for a new device to be created.

Let’s see, then delete the old one

1 Like

Add this to the list of oddities … Scanning is not finding anything.

Not sure if it’s relevant but the ‘old’ driver has not picked-up the renaming either. I can successfully go back to it though. I don’t know if the driver name needs to be unique and perhaps it’s getting confused.

It’s working that way. Old device and driver needs to be removed, prior to adding new one.
All good. Just made schedule for time change on November 6th

Ok Sorry, I know what’s up.

  • Make a driver change to -(OLD)
  • Delete version Mc from hub
  • Install this new version
┌─────────────┬──────────────────────────────────────┐
│ Name        │ Virtual Calendar Mc                  │
│ Package Key │ virtual-calendar-v2                  │
│ Version     │ 2022-06-14T21:16:25.730842323        │
└─────────────┴──────────────────────────────────────┘
  • Make the driver change again and it will work

Problem with that though is any automations using the old are going to get deleted too right? Unfortunately I set a load up yesterday.

With this new version it is no longer necessary delete the device OLD, I added a profile switch with a function device:try_update_metadata () that is executed with the driverSwitched lifecycle.

When new driver version is switched then you can delete the -(OLD) version from your hub

Sorry, it was an error due to my inexperience with drivers with virtual devices

You don’t have to loose Routines (automations). create dummy virtual device and place them where you have old virtual calendar.then just swap for new calendar
I have couple virtual devices for swapping/ creating and testing Routines, for Open/Close, presence, day/night, etc…

1 Like

Okay, did this. Once on the new driver Settings shows this:


I still get no option on the device page to make the setting and setting as above does nothing. Furthermore, going back to old driver it won’t take the offset any longer.

In that field you do not have to enter anything, it is only version information.

You close the app and when you reopen the device, the capability to enter the local time offset must appear at the end

For the driver change backwards to work you have to have this version of the driver (OLD) installed

┌─────────────┬──────────────────────────────────────┐
│ Name        │ Virtual Calendar Mc-(OLD)            │
│ Package Key │ virtual-calendar                     │
│ Version     │ 2022-06-14T21:44:08.89055466         │
└─────────────┴──────────────────────────────────────┘

I tested mani times switching from (OLD) to New or viceversa and it works perfectly on android