No announcement yet.

How to capture a date and time

  • Filter
  • Time
  • Show
Clear All
new posts

    How to capture a date and time

    Hello all,

    Can someone help me with the following. I would like to capture the date and time when an event happends ( power outage, measured via UPS) and when the internet connection is back send that date and time with a pushover message.

    I guess I have to use a virtual device for that , but how do I insert in that virtual device the date and time.
    Trigger will be : If BLups goes on battery power
    but than ?????

    Than send the info with pushover:
    Trigger will be a ping sensor from Jon00
    But how to put that info Date and time in a push over message?

    Many thanks for your help ,

    You could use an immediate script to get it into a virtual device

    If BLups goes on battery power
    Then run an immediate script &hs.SetDeviceString(dvRef, Now.ToString("d") & Now.ToString("t"), True)

    where dvRef is the device reference number for the virtual device.

    Can't help with the second part - Sorry.


      For the second part, you can use
      where REF if the device reference and this will be replaced with the device string.
      Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
      X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
      Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
      Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
      Scripts =


        Pushover supports replacement variables in the messages - you can therefore keep the date/time either in a device string or if you anticipate that the event will trigger instantly then you can just use $DATE and $TIME without the need for the device.

        Here is the full list -


          This VB immediate script will do it as an event action item, setting the "name" named virtual device string to the current date/time (for example "08/06/20 11:47AM"). The VB format statement has a lot of options, if you want the date/time in a different format.

          &nhs.SetDeviceStringByName("name", Format(Now(),"MM/dd/yy h:mmtt"), False)



            Working like a charm! Many thanks guys.

            One small thing , not important , but would be nice optically:
            Would it be possible to remove the Off-on buttons? I tried deleting both status/controlls rows , but than the script didn't work anymore.

            *edit* another thing which I can't get my head around. I would like to send a message when the power is restored AND as soon as the internet connection is back online.
            That would be: If BLups is on AC power AND Google ping has the value 1 >> send pusover message
            But if there is no internet connection yet , How would I delay this event untill the google ping has the value 1

            Click image for larger version  Name:	2020-08-07 09_22_30-Devices.jpg Views:	0 Size:	5.7 KB ID:	1409256

            Click image for larger version  Name:	2020-08-07 09_22_12-Device Settings.jpg Views:	0 Size:	36.8 KB ID:	1409257


              How about using the device last changed date and time? use this to monitor sensors and such for when they last changed state. I use this in HSTouch screens for my alarm sensors. Handy ways to see when something changed.



                srodgers : I initially had an event to send a pushover message when the device changes from ac to dc power , but occasionally there is a glitch. So , now I have an event with a timer , when the power outage is 30 seconds or more. Hence the date and time in a virtual device.