(EDGE Driver-Mc): Aplicaciones Virtuales Mc (virtual Switch Mirror, Virtual Calendar and virtual Switch Board...)

I’ve just noticed that there is like a 35 seconds delay between my phone time (automatically synced) and the time reported by the Calendar virtual device. I understand that the diference is negligible, but wondering if there is someway to offset that time. Thank you very much in advance!

There may be a lag with the real time never greater than 59 sec, depending on what second the 60 sec timer is activated, I didn’t think it was that important.

I will look at it

This version sync local time in random 0 to 5 sec max.
This random range of 0 to 5 sec is made so that if a user has more than one virtual calendar created, their timer does not coincide at exactly the same second to update the data.

The seconds that we see in the App may be one or two more, depending on how fast the events in the app are updated through the cloud, but in the CLI you can see exactly the second in which the event is emitted.

───────────────────────────────────────────────────
 Name         Aplicaciones Virtuales Mc
 Version      2024-02-07T20:20:34.933308254        
───────────────────────────────────────────────────

Thanks for the feedback and the update Mariano! I understand that the difference was negligible and was not my intent to make a big deal out of it. Thank you very much again for your support to this community, it is indeed very appreciated :slight_smile:

Virtual device to List Devices and battery level

New version of the Aplicaciones Virtuales Mc driver:

At the request and the great help of @TapioX, I have created a new type of virtual device.

  • It is a virtual device that can create and display a list of device events ordered from newest to oldest.

  • The list shows month/day and hour with minutes and seconds, followed by the device name and event

  • Between 0 and 100 events can be listed. Selectable in preference settings.
  • The value = 0, by default, deletes the list and does not record or display events

  • Once the selected number of events has been exceeded, the oldest ones are deleted and the new events received are added.
  • Events are received through two text fields:
    • Device Name
    • Device event
  • Events can be sent to the virtual device with routines or rules
  • The possible use may be for debugging certain routines or critical rules. Maybe @TapioX can help something about it

New driver version will be updated automatically in 12 hours maximum

───────────────────────────────────────────────────
 Name         Aplicaciones Virtuales Mc
 Version      2024-02-13T17:13:53.68734302        
───────────────────────────────────────────────────
5 Likes

Examples how to use List Events Device:

2 Likes

New version of Aplicaciones Virtuales Mc

Several users asked in the community how to make a function that can activate or deactivate the STHM (SmartThings Home Monitor) modes on a delayed basis.

I have added a new virtual device to control Security Mode in STHM.


Device has a stock capability β€œsecuritySystem”, which directly changes security modes in the user’s STHM, without the need for a routine. I was not aware that this capability could perform the mode change in STHM directly.
Capability function is not bidirectional, i.e. the β€œsecuritySystem” capability on the virtual device changes the state of STHM, but state changes in STHM do not update the β€œsecuritySystem” capability on the virtual device.
To have it synchronized it is necessary to make three routines that update the virtual device state when the state in STHM changes manually. i.e. like this routine:

Allows you to arm and disarm security modes instantly, just like in STHM:

  1. Performing the state change in the security mode capability of the virtual device, manually or with a routine

Allows arming and disarming of security modes with a custom delay:

  1. You need to create a different code for each Security Mode:
  • Initial Code for Mode Disarmed: 111
  • Initial Code for Mode Armed Away: 222
  • Initial Code for Mode Armed Stay: 333
  1. How to create the custom code:
  1. In preferences set the custom dalay for each Security Mode

  2. Write the code for the Security Mode to Change in capability β€œCode for Delayed Security Mode” or could set Code with Routines, scene or rules API:

  • By pressing a muti-button sequence with routines or
  • Sending code with a routine, rule or scene.
    For example: I have used a Fibaro KeyFob, with 6 buttons. Assigning to each button press a value to be sent to the virtual device in 6 routines. That way I can arm and disarm the STHM in a personalized way by entering the code sequence on the KeyFob remote. When the code is sent sequentially, there is a time limit of 5 seconds between keystrokes. If this limit is exceeded, the entered value is deleted and you have to start over with the first character of the code.
  1. After correct code and Mode Delay, Security Mode will change in STHM




The three current Mode Codes saved can see in CLI logs:

  1. In preferences set: β€œShow logs Debug Print in CLI”
  2. Write any text in old Code or new Code capability
  3. in Cli logs can see three saved Codes
2024-02-26T11:42:04.673182594Z PRINT Aplicaciones Virtuales Mc  <<< DEVICE_CODE_AWAY:      222
2024-02-26T11:42:04.677798302Z PRINT Aplicaciones Virtuales Mc  <<< DEVICE_CODE_STAY:      333
2024-02-26T11:42:04.682208885Z PRINT Aplicaciones Virtuales Mc  <<< DEVICE_CODE_DISARM:    111

A preference has also been added to show or not display the device’s instructions for use in the details view. This instruction steps appears 3 sec after the action information message or when refresh command.
This preference has also been added to the number field + calculator profile

EDIT: SmartThings has removed the HTML text from text capabilities, both in the app and on the web, so the instructions for use are no longer displayed correctly.

This version of the driver will be updated automatically in 12 hours maximum.

If anyone finds any problem, please tell me and I will try to fix it.

───────────────────────────────────────────────────
 Name         Aplicaciones Virtuales Mc
 Version      2024-02-26T12:13:43.855002233
───────────────────────────────────────────────────
8 Likes

@Mariano_Colmenarejo I have tried creating a virtual security device and list device events device several times and it keeps creating virtual mirros devices. All other devices are created correctly. Any ideas?

Edit to add: I have an Aeotec and V3 hub. It works on the V3 but not the Aeotec hub.

Hi @Terri_Baker,

Do they have different firmware?

Aeotec is 51.2
V3 is 52.9

Virtual security uses the new subdriver lazy load feature that is implemented in firmware version 52.x, but should work with older firmware as well.

I did it this way because I saw that smartthing has already implemented it in the zwave switch driver in production and according to the pull request it is tested that it works with the firmware libraries prior to 52.x.

Please, Could you send me a log of when you create a virtual security device in the aeotec hub? It should only affect this device, not the rest like and it seems that it also affects the device event

For logs, active show CLI logs for debug in preferences

I have Virtual Security working on one of my v2 hubs with FW 51.2.

1 Like

Anyone have suggestions for how to trigger based on the hour changing in Virtual Calendar? I see LocalHour but it is the current time in hhmm and I was hoping to have just the hour value to trigger off.

What do you mean by changing the local time to summer or winter or activating a routine when it is a certain local time?

Have a trigger that allows routines to run each hour when it changes (2pm to 3pm, etc.)

I’m sorry I don’t understand you correctly.

Execute a routine continuously every exact hour or only execute one routine when it’s 2:00 or 3:00…?

Virtual Calendar has a localhour object and it stores the local time. I was wondering if there is a way to get just the hour portion. I was trying to use just the hour changing as a trigger.

With the virtual calendar it cannot be done.

But it can be done with the Timer of Seconds virtual device and two routines:

Set the timer in 3600 sec
Set timer type permanent
Set Number of loops = 0 (infinite loops)

1. Routine:
This synchronizes the timer with the hour exactly. It can be 00:00 or any exact time 01:00… 06:00

  • IF: every day at 00:00

  • THEN: Timer 3600 sec restart

2. Routine:
Every time 3600 sec is reached, the Timer switch will turn off for 3 seconds and turn on again. This will trigger the action

  • IF: Timer 3600 sec, Switch = Off
  • THEN: perform one action. (Change the state of a light, for example)

4 Likes

Hi! Wondering what are the limits for β€œSunset offset to local time” and β€œSunrise offset to local time”. I belive the latter starts at 0 at Sunrise and remains possitive up to 1440 and then goes back to 0, while the former splits the day in halves, from -720 at sunrise, 0 at sunset and then positive up to 720? Im a little bit confused . Thanks!