Announcement

Collapse
No announcement yet.

converting DM Custom action codes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    converting DM Custom action codes

    I am in the process of converting from DM to BLRadar. I was successful in using the converter to import my devices into BLRadar, but i need some help with converting the Custom Action Codes that I have assigned to some of the devices.

    I looked through the Help files, but I'm not very good at scripting - but I'm pretty good at cut and paste....

    If someone could help me with the following, I think I can figure out the others from this example.


    The current DM code is:

    If DateDiff("n", Sensor.LastOn, Now) > Sensor.NormalElapsedTime Then
    msg = "There is a guest at the front door"
    hs.plugin("LEDAM").SendMessage "msg", "{5reg}{green}" & msg, "start", 12, 60, 5, 0
    hs.speak CStr(msg), True

    End If
    If dm.NightTime Then hs.ExecX10ByName "Outside Front Entrance", "on"
    dm.NewNoMotionDelayedEvent "Outside Front Entrance Off", "Outside Front Entrance:Off",10



    The other issue that I need some help with the formatting of BL device text strings. While the text shows correctly in the HS device, when I try to use the text in my xLobby screens it displays as:

    "  Active Zone On &nbspo days, 0 hrs, 3 mins, 9 secs)

    How do I get rid of the extra characters? I just want to display "Active Zone On"..

    THANKS!

    #2
    Try this:

    Code:
    If DateDiff(DateInterval.Minute, Sensor.LastOn, DateTime.Now) > Sensor.NoEchoTime Then    
        Dim msg As String = "There is a guest at the front door"
        hs.plugin("LEDAM").SendMessage("msg", "{5reg}{green}" & msg, "start", 12, 60, 5, 0)
        hs.speak(msg, True)
        msg = Nothing
    End If
    If blradar.NightTime Then
        hs.ExecX10ByName("Outside Front Entrance", "on")
    End If
    blradar.NewDelayedEventForNoEcho("Outside Front Entrance Off", "Outside Front Entrance:Off",10)
    Cheers,
    Bob
    Web site | Help Desk | Feature Requests | Message Board

    Comment


      #3
      Perfect. That will get me going on converting the actions...


      Is there a solution to my other issue with text strings having additional characters??


      "  Active Zone On &nbspo days, 0 hrs, 3 mins, 9 secs)



      How do I get rid of the extra characters? I just want to display "Active Zone On"..

      Comment


        #4
        Originally posted by gelessor View Post
        Perfect. That will get me going on converting the actions...


        Is there a solution to my other issue with text strings having additional characters??


        "  Active Zone On &nbspo days, 0 hrs, 3 mins, 9 secs)



        How do I get rid of the extra characters? I just want to display "Active Zone On"..
        There is an option in BLRadar called "Include time information in active zone device strings"
        Turning this off should remove the time info from the device string.

        For removing the the html look at my BLTouchString plugin. It is on my web site and it shows you the script command you can use to remove all html from the device string.
        Cheers,
        Bob
        Web site | Help Desk | Feature Requests | Message Board

        Comment


          #5
          Will do.

          Thanks again Bob - not only are your products top notch, but your responsiveness and willingness to help is much appreciated,

          Thanks

          Comment


            #6
            Scripting for Dummies...

            I need a little help with BL Touchscreen usage. I see there is a command of "hs.Plugin("BLTouchString").GetFormattedDeviceString("O5 "). I assume it would get the non-formatted value of device "O5".

            How would I write a script that I could trigger when the value of "O5" changes that would create a new virtual device of "099" that would be the non-formatted value of "O5"?

            Comment


              #7
              Originally posted by gelessor View Post
              I need a little help with BL Touchscreen usage. I see there is a command of "hs.Plugin("BLTouchString").GetFormattedDeviceString("O5 "). I assume it would get the non-formatted value of device "O5".

              How would I write a script that I could trigger when the value of "O5" changes that would create a new virtual device of "099" that would be the non-formatted value of "O5"?
              You will have to create the O99 device first (manually), but that will not take long.

              Once O99 is created then you will want to create an event that triggers on device status change. I would set the device to trigger on "changed to any status".
              Then in the action for the event you will choose "Run Script" action.

              Click Switch to Advanced View
              Then in the script statement area, enter this:

              Code:
              &hs.SetDeviceString "O99", hs.Plugin("BLTouchString").GetFormattedDeviceString("O5")
              This should set the O99 device string to the stripped down text of O5

              Try and let me know
              Cheers,
              Bob
              Web site | Help Desk | Feature Requests | Message Board

              Comment


                #8
                Wow!

                You sure made that easy. Now I'm off the converting everything and updating.

                Thanks..

                Comment


                  #9
                  21 radar sensors up and working with converted codes.

                  I'm struggling with this one...

                  In the kitchen I'd like to turn 3 lights on if they are not already on AND if there is motion.

                  Where did I go wrong with the following?

                  F7 is to check to see if one of the lights is already on




                  If hs.ison ("F7") And
                  If DateDiff(DateInterval.Minute, Sensor.LastOn, DateTime.Now) > Sensor.NoEchoTime Then
                  hs.ExecX10ByName ("Kitchen Desk Lamp", "On")
                  hs.ExecX10ByName ("Kitchen Wine Rack Lamp", "On")
                  hs.ExecX10ByName ("Kitchen Soffett Lights", "On")
                  End If
                  blradar.NewDelayedEventForNoEcho("Kitchen Desk Lamp Off", "Kitchen Desk Lamp:Off",10)
                  blradar.NewDelayedEventForNoEcho("Kitchen Wine Rack Lamp Off", "Kitchen Wine Rack Lamp:Off",8)
                  blradar.NewDelayedEventForNoEcho("Kitchen Soffett Lights Dim To Off", "Kitchen Soffett Lightsim To Off",15)

                  Comment


                    #10
                    try this:

                    Code:
                    If hs.ison("F7") AndAlso DateDiff(DateInterval.Minute, Sensor.LastOn, DateTime.Now) > Sensor.NoEchoTime Then
                        hs.ExecX10ByName("Kitchen Desk Lamp", "On")
                        hs.ExecX10ByName("Kitchen Wine Rack Lamp", "On")
                        hs.ExecX10ByName("Kitchen Soffett Lights", "On")
                    End If
                    blradar.NewDelayedEventForNoEcho("Kitchen Desk Lamp Off", "Kitchen Desk Lamp:Off",10)
                    blradar.NewDelayedEventForNoEcho("Kitchen Wine Rack Lamp Off", "Kitchen Wine Rack Lamp:Off",8)
                    blradar.NewDelayedEventForNoEcho("Kitchen Soffett Lights Dim To Off", "Kitchen Soffett Lightsim To Off",15)
                    Cheers,
                    Bob
                    Web site | Help Desk | Feature Requests | Message Board

                    Comment


                      #11
                      Thanks again. I forgot one little piece. Who do I add to only control the lights between certain hours? I need to add that to the custome code. Maybe 11:30 pm until 6am

                      Comment


                        #12
                        Here is the code from my master bathroom ON sensor:

                        Code:
                        	blradar.NewDelayedEventForNoEcho("Master Bathroom Sink Control", "Master Bathroom Sink Light:off", 5)
                        	if hs.IsOffByName("Master Bathroom Sink Light") Then
                        		dim ntime as date = TimeValue(DateTime.Now)
                        		if ntime >= TimeValue("11:00 pm") AndAlso ntime <= TimeValue("11:59 pm") then
                        			hs.ExecX10ByName("Master Bathroom Sink Light", "DDim", 35)
                        		elseif ntime >= TimeValue("9:00 pm") AndAlso ntime <= TimeValue("10:59 pm") then
                        			hs.ExecX10ByName("Master Bathroom Sink Light", "DDim", 45)
                        		elseif ntime >= TimeValue("12:00 am") AndAlso ntime < TimeValue("4:15 am") then
                        			hs.ExecX10ByName("Master Bathroom Sink Light", "DDim", 35)
                        		elseif ntime >= TimeValue("4:15 am") AndAlso ntime <= TimeValue("6:59 am") then
                        			hs.ExecX10ByName("Master Bathroom Sink Light", "DDim", 30)
                        			dim currentWeekDay as integer = Weekday(CDate(DateTime.Now))
                        			dim shift as string = hs.DeviceStringByName("Home Trista Work Shift")        
                        			dim code as string = hs.GetDeviceCode("Home Bob Vacation Day")
                        			dim bobVacStatus as integer = hs.DeviceStatus(code)
                        			if instr(1, shift, "Days") > 0 OR _
                        			   (currentWeekDay <> 1 AND currentWeekDay <> 7 AndAlso bobVacStatus = 3) then
                        				if ntime >= TimeValue("5:00 am") then
                        					blradar.NewDelayedEventForNoEcho("Master Bathroom Sink Morning Wakeup Control", "Master Bathroom Sink Light:dimto-100", 4)
                        				end if
                        			end if
                        			code = nothing
                        			bobVacStatus = nothing
                        			shift = nothing
                        			currentWeekDay = nothing
                        		else
                        			hs.ExecX10ByName("Master Bathroom Sink Light", "DDim", 100)  ' full light
                        		end if
                        		ntime = nothing
                        	end if
                        Cheers,
                        Bob
                        Web site | Help Desk | Feature Requests | Message Board

                        Comment


                          #13
                          That's an elaborate motion code.....

                          I'll need a little time to sort that one out. Good to know you can have so many multiple options.

                          Comment


                            #14
                            What did I do wrong....

                            This doesn't work.

                            If hs.isoff("F7") AndAlso DateDiff(DateInterval.Minute, Sensor.LastOn, DateTime.Now) > Sensor.NoEchoTime Then
                            dim ntime as date = TimeValue(DateTime.Now)
                            if ntime >= TimeValue("11:30 pm") AndAlso ntime <= TimeValue("06:59 am") then
                            hs.ExecX10ByName("Kitchen Desk Lamp", "On")
                            hs.ExecX10ByName("Kitchen Wine Rack Lamp", "On")
                            hs.ExecX10ByName("Kitchen Soffett Lights", "On")
                            End If
                            blradar.NewDelayedEventForNoEcho("Kitchen Desk Lamp Off", "Kitchen Desk Lamp:Off",10)
                            blradar.NewDelayedEventForNoEcho("Kitchen Wine Rack Lamp Off", "Kitchen Wine Rack Lamp:Off",8)
                            blradar.NewDelayedEventForNoEcho("Kitchen Soffett Lights Dim To Off", "Kitchen Soffett Lightsim To Off",15)


                            What I'm trying to accomplish....

                            If it is nighttime and device "F7" is off and there is movement then turn on some lights....

                            Comment


                              #15
                              Hate to continue to be a pain but I am also struggling with this DM code to determine if a car is home or away.



                              If sensor.lastoff > sensor.laston and DateDiff("n", sensor.lastoff, now) > 5 Then
                              hs.SetDeviceString "v52", "On the road"
                              hs.WriteLog "car debug", "Changing Amanda's Ford Escape status to on the road"
                              hs.SetDeviceLastChange "v52", now
                              End If

                              If DateDiff("n", sensor.laston, now) > 8 and sensor.laston > sensor.lastoff Then
                              hs.SetDeviceString "v52", "Parked"
                              hs.WriteLog "car debug", "Changing Amanda's Ford Escape status to parked"
                              hs.SetDeviceLastChange "v52", now
                              End If

                              Comment

                              Working...
                              X