Announcement

Collapse
No announcement yet.

Where can I find sample scripts and learn about scripting ?

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

    Where can I find sample scripts and learn about scripting ?

    I have done a few small scripts (with plenty of help from the forum) and want to learn more. Sample scripts are a good way of learning, and give ideas as well. I had a look at the help file but really struggle to understand.
    Are there any other resources ? I am also trying to find answers to questions which did not get answered on here, but I am not sure where I can find those. I did try google for some of my questions but couldn't really find anything either.

    #2
    I would potentially approach it slightly differently...scripts are Visual Basic .net so if you learn the basics of .net then you will start to learn how scripts work (if...then, select case, looping etc) - YouTube has plenty of tutorials on vb.net and places like vbcode.com and http://www.visual-basic-tutorials.com/

    All of the HomeSeer commands are documented in the help file under scripting, in reality to use them you really need to understand a bit about VB otherwise they make little sense.

    There is no repository of scripts unfortunately and like anything posting them can be a bit of double edged sword (like if I or someone started a tutorial thread) because there is no right and wrong way for some problems and professional programmers are unlikely to offer any wisdom.

    For things also where you are not getting any answers then I am afraid this can be because to test some things and check they work may need someone to create devices, load the script and check things - can take minutes - something simple wrong might be solveable just by looking at it but anything else might be a bit more of a chore.

    Comment


      #3
      OK that all makes perfect sense, hence the idea of trying to solve the problems myself. These are good starting points. I'll look into visual basic. I used to program a lot in Basic years (more like decades) ago, some of the principles still work in vb so I dont have to start from 0 at least.

      Comment


        #4
        You can do a whole lot more with HS3 events than you ever could with HS2. In HS2 I used a lot of scripting to get round limitations with the event engine but now in HS3 I find that I only need a handful of scripts. The downside is that often you will need quite a complex event or multiple events to do something that you can do in a few lines of code.

        I would agree with mrhappy in that getting a handle on VB and program flow in general will go a long way when scripting in HS.

        The most frequent uses of scripting for me are:

        Else - There is no concept of else in HS3 as you have learned in your recent air-con scripting expedition.

        Comparing Device Values - I often use scripting when doing things like If Device A > Device B etc, although I believe the EasyTrigger plug-in makes light work of doing this in events.

        Populating devices with calculated values - I use scripting to do things like trending my barometer reading over time.

        If you have any specific requirements, then I'm happy to help you wherever I can. Just ask..

        Paul..

        Comment


          #5
          Although it's not the place to start to learn about vb.net, I'd also add TenScripting for HS3 as an extremely useful tool to help make script creation as efficient as possible. It provides many checks to code to identify common typographical and syntax errors as well as offering auto completion suggestions for most commands.
          Mike____________________________________________________________ __________________
          HS3 Pro Edition 3.0.0.548, NUC i3

          HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

          Comment


            #6
            Originally posted by sooty View Post
            You can do a whole lot more with HS3 events than you ever could with HS2. In HS2 I used a lot of scripting to get round limitations with the event engine but now in HS3 I find that I only need a handful of scripts. The downside is that often you will need quite a complex event or multiple events to do something that you can do in a few lines of code.

            I would agree with mrhappy in that getting a handle on VB and program flow in general will go a long way when scripting in HS.

            The most frequent uses of scripting for me are:

            Else - There is no concept of else in HS3 as you have learned in your recent air-con scripting expedition.

            Comparing Device Values - I often use scripting when doing things like If Device A > Device B etc, although I believe the EasyTrigger plug-in makes light work of doing this in events.

            Populating devices with calculated values - I use scripting to do things like trending my barometer reading over time.

            If you have any specific requirements, then I'm happy to help you wherever I can. Just ask..

            Paul..
            I have only been using Homesser for 2 months, I am coming from Vera so everything is a lot better anyway, and I find too that you can do a lot with events. But yes, you do need a few scripts.
            One thing you might be able to help.
            I am trying to create a virtual thermostat. I think I can use a script to change the device from a normal virtual switch to a thermostat. I did read through the link I've been given, I think the answer is in there but I just dont understand it enough. Maybe you have an idea.
            This is the thread, think its easier than to replicate the question again

            http://board.homeseer.com/showthread.php?t=182769

            Comment


              #7
              Originally posted by mikee123 View Post
              I have only been using Homesser for 2 months, I am coming from Vera so everything is a lot better anyway, and I find too that you can do a lot with events. But yes, you do need a few scripts.
              One thing you might be able to help.
              I am trying to create a virtual thermostat. I think I can use a script to change the device from a normal virtual switch to a thermostat. I did read through the link I've been given, I think the answer is in there but I just dont understand it enough. Maybe you have an idea.
              This is the thread, think its easier than to replicate the question again

              http://board.homeseer.com/showthread.php?t=182769
              Take a look at this post as well: http://board.homeseer.com/showpost.p...21&postcount=5

              Cheers
              Al
              HS 3.0.0.548: 1990 Devices 1172 Events
              Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

              Comment


                #8
                Originally posted by sparkman View Post
                Take a look at this post as well:
                In addition to looking at the post, it might also be worth while to ask Shill what he's gone through to get his thermostat plug-in to work. I don't think creating a thermostat (at least one that HS recognizes as a thermostat) is a the best choice for a starter project.
                Mike____________________________________________________________ __________________
                HS3 Pro Edition 3.0.0.548, NUC i3

                HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                Comment


                  #9
                  Originally posted by sparkman View Post
                  Take a look at this post as well: http://board.homeseer.com/showpost.p...21&postcount=5

                  Cheers
                  Al
                  I had a look at that post, and can see some information I have to try and set my device to. But I'm sorry this is way beyond my current knowledge, no matter how long I look at it. And looking what I found in the 'manual' trying to find where I have to insert the devicetypeinfo etc, I'm just lost.
                  So the answer is there, I just cant see it...

                  Comment


                    #10
                    Originally posted by Uncle Michael View Post
                    In addition to looking at the post, it might also be worth while to ask Shill what he's gone through to get his thermostat plug-in to work. I don't think creating a thermostat (at least one that HS recognizes as a thermostat) is a the best choice for a starter project.
                    I can see its probably a very advanced project. But at the moment creating a virtual thermostat is the only proper solution to my problem. So got to try...

                    Comment


                      #11
                      Hello, Mikee123

                      A virtual thermostat plugin exist created by a french developer:

                      http://www.touteladomotique.com/foru...p?f=71&t=11276

                      Jean-Francois.

                      Comment


                        #12
                        I had a look at that thermostat plugin. I struggle a little bit with french, google translate helped a bit though> I dont think this can just create a virtual thermostat, which I want to use to load a schedule from BLStat to. But I will have a closer look when I've got some time to play with it.
                        But good find anyway, thank you.

                        Comment


                          #13
                          I don't use any thermostats with HS3 so I'm not really experienced in that area but I'm happy to have a go at knocking up a script to create the necessary devices.

                          Here in the UK a thermostat is generally a much simpler affair controlling a single heating or cooling appliance without fan control etc which in HS may be represented by the following devices:

                          Root (Used to group related devices)
                          Temperature (To display the current measured temperature)
                          Setpoint (The value to work towards)
                          Status (Demand)

                          Is this what you're looking for?
                          How will the measured temperature be obtained?

                          Paul..

                          Comment


                            #14
                            For my purposes I only need a heat setpoint. If I need a temperature I can specify a device if needed, but as it's not needed for my application let's call it ref 14. I am sure I will need the root. Status probably as well, for it to be recognised by BLStat I guess temperature as well. I am in the UK too.
                            I really appreciate you trying to help.

                            Comment


                              #15
                              I'm not familiar with BLStat but I expect it will be looking for a root device of type "thermostat" then some child devices to decide what functionality the thermostat has.

                              The general concept of a thermostat would normally result in at least 3 devices, setpoint, temperature and status/control and some logic to go with it (If Temp < Setpoint Then Set Control ON etc...)

                              From your last post, it appears that you are just wanting to control a setpoint value with BLStat, correct?

                              How are you intending to use that within HS3?

                              I'll have a play this evening with creating the device(s) from a script and see what's possible.

                              Paul..

                              Comment

                              Working...
                              X