Announcement

Collapse
No announcement yet.

Plugin Question for RS232 Aircon Automation

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

    Plugin Question for RS232 Aircon Automation

    Hi,

    I have just been given an automation module for my Aircon system that uses an RS232 interface and I found this Homeseer plugin which I'm hoping is exactly what I need, but just want to check if it can do the following for me?h
    1) Create a device showing the current status of the System (On/Off, Fan Speed, Mode etc) and the ability to then change these so I can turn the system on/off or from heat to cool via Homeseer.
    2) Create a device (or maybe sub-device) for each Zone (Room) showing the status of each zone and the ability to change these (open/close zone or set temperature)


    I have attached the documentation for the module, note in Section 4.8 it can send automatic status updates to keep my Homeseer devices up-to-date.

    Any guidance or hints on how to set this up would be greatly appreciated as I've not used this plugin or RegEx expressions before.

    Many thanks
    Richard
    Attached Files

    #2
    rpalmer68


    Yes, Big5 can make it happening for you. No problem. Actually RS232 is one of the easiest interfaces to manage. There are two parts in general

    1. Sending out commands
    2. Retrieving and storing the feedback from the system into HomeSeer devices.

    It all starts with you creating a "Serial" profile in your Big5 settings. You specify the serial port and the speed 9600 typically there. You will also setup "name" and "value" expressions in order to properly parse the incoming information. More on that later.

    1. To send out a command just create HS event and choose "Big5 Serial" action from the drop down menu for action. Select your serial profile and put your command in the text message box.
    Important: Do not forget termination characters /r and /n that are important for RS232 communication. You enter them exactly as shown here /r /n

    2. Receiving the data is automatic. Big5 will create/update HomeSeer devices for you with the values received. However you have to "tell" Big5 how to interpret the incoming data. This is accomplished with the "name" and "value" expressions in the Serial profile.

    Let's take the command / response below as an example

    C: ZST=4
    R: +ZST=4,1,2550,1,2530

    Here comes the fun part.

    You can use the "Name expression" like this within your Serial profile for the names of HomeSeer devices

    Code:
    Split(input, ",")[0]+"mode" && Split(input, ",")[0]+"setpoint" && Split(input, ",")[0]+"position" && Split(input, ",")[0]+"temperature"
    For the "Value Expression" you can use this

    Code:
    ParseNumber(Split(input, ",")[1]) && ParseNumber(Split(input, ",")[2])/100 && ParseNumber(Split(input, ",")[3]) && ParseNumber(Split(input, ",")[4])/100
    Big5 will create the following HomeSeer devices for you

    Name Value

    +ZST=4mode 1
    +ZST=4setpoint 25.5
    +ZST=4position 1
    +ZST=4temperature 25.3

    You can change the names later. No worries. Big5 will "remember" to update the same devices.

    If all of the above sounds like Chinese to you than don't worry. You are not alone. There is slight learning curve but it is actually easy and fun once you are over it. Remember that Big5 is made for non programmers and no programming skills are needed. Everything is well documented online at http://big5.ivanv.com

    Comment


      #3
      Thanks so much for the detailed reply.

      So if my module is sending out a status for the system, say +SYS=1,1,1,0,4,0,1 and a Status for each Zone (as per your message) every minute and also when something changes, do I use two profiles to spit them (System Profile and Zone Profile) or do I need to split the +SYS responses and + ZST responses in the one profile?


      +SYS=[on/off],[ SystemMode],[SystemFan],[Economy],[FreshAirMode],[FilterON/OFF],[UVLightON/OFF]

      Where:

      On/off can be:
      1 for system running and
      0 for System not running.

      SystemMode can be:
      1 for mode COOL
      2 for mode HEAT
      3 for mode VENT
      4 for mode AUTO

      SystemFan can be:
      1 for fan LOW
      2 for fan MEDIUM
      3 for fan HIGH

      Economy can be:
      1 for ON
      0 for OFF

      FreshAirMode can be:
      0 for Fresh Air not Installed
      1 for Outside Air
      2 for Recirculated Air
      4 for Automatic Selection 8 or 16 may also be returned, in this case it still means automatic selection

      FilterON/OFF can be:
      1 for ON
      0 for OFF

      UVLightON/OFF can be:
      1 for ON
      0 for OFF

      Comment


        #4
        Advanced Big5 users could do it with one profile but I’d recommend 2 profiles for starters. Also do not rush it. Know what you are doing and do one thing at a time. Wrap each expression in ${…} wrapper and test it in the sandbox. Pls. note that && are separators between multiple expressions.

        Comment


          #5
          Wait, 2 profiles only if you can split the communication over 2 different serial ports. If not than you have to use one profile. Still perfectly fine. The dynamic allocation of names (as per the example at the top) allows to distinguish between SYS and ZST. As far as SYS has longer response you need to extent the number of expressions separated by && following the same logic. Division by 100 in the above example has to be removed as the same expression will handle both SYS and ZST.

          Comment


            #6
            OK, cool.

            So I assume that means I need to use generic names (Value1, Value 2 etc) now as the names for passed values for the Zones and System are different?

            But I'm a little confused, won't +SYS=1,1,1,0,4,0,1 produce one set of devices and +SYS=0,1,1,0,4,0,1 another as the first value which indicates on or off with the +SYS is the Zone number for the +ZST?

            So +SYS=1,2,1,0,4,0,1 would produce:

            Name Value
            +SYS=1Value1 2
            +SYS=1Value2 1 etc

            While So +SYS=0,1,1,0,4,0,1 would produce
            +SYS=0Value1 2
            +SYS=0Value2 1 etc

            I'm just waiting for the module to get connected to the system and to ensure it actually works, then I can buy the plugin and have a play with the sandbox....


            Richard

            Comment


              #7
              rpalmer68

              Good catch. You are correct. It will produce two sets of devices. Big5 has a cure for that too. You can use "Device affect expression" to ignore input that starts with +SYS=0.

              This "Device affect expression" will do the trick for you

              StartsWith(input, "+SYS=1") or StartsWith(input, "+ZST")

              as an additional benefit it will also filter out any "gibberish" or "noise" that sometimes appears on RS232 serial interface.

              Comment


                #8
                Ah ok, that will work when the system is running , but then won't Big5 ignore any System (+SYS) updates that comes in when the aircon is Off (+SYS=0), I'd still like the updates from the system whatever status it is (On or Off) if possible as modes etc can still be changed when the system in Off..

                Comment


                  #9
                  Well in this case you extend the filter to include status off as well or remove the filter. As you noticed before there will be two sets of HS devices. I think however that HS allows you to synch devices.
                  Another option would be to modify the name expressions to distinguish between +SYS and +ZST. You’ll find conditional expressions in the online documentation that will fit the bill.

                  Comment


                    #10
                    OK, I'll look into conditionals for the Name expression.

                    A thought I had was if it was possible to manipulate the incoming string? So "+SYS=" gets a ",1" added appended to become "+SYS=1," before it is processed by the Name expression then the current name expression would work as the device names then be "+SYS=1Value1", "+SYS=1Value2" etc.

                    Comment


                      #11
                      Here is something to try for Name Expression. Repeat as many times as needed changing the "..text..." and separated by &&

                      Code:
                      ${If (RegexMatch(input,"[Y]"), "SYS", Split(input, ",")[0]) + "_your_text_here"}
                      It looks for the letter "Y" in the string as far as SYS has it and ZST doesn't than it will return simply the name "SYS" (regardless of on or off status) if input has SYS and will return same as before for ZST

                      Comment


                        #12
                        Thanks,

                        I've been having some fun with the sandbox tonight working on the Values expression, as I need to get the first value for the +SYS response which is the zone number in the +ZST response.

                        I've come up with this that seems to work:

                        Code:
                        Input:  +ZST=4,1,2550,1,2530
                        If (RegexMatch(input,"[Y]"), ParseNumber(Substring(Split(input, ",")[0],5)), ParseNumber(Split(input, ",")[1])) --- [I]1[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[1]), ParseNumber(Split(input, ",")[2])/100) --- [I]25.5[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[2]), ParseNumber(Split(input, ",")[3])) --- [I]1[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[3]), ParseNumber(Split(input, ",")[4])/100) --- [I]25.3[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[4]), 0) --- [I]0[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[5]), 0) --- [I]0[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[6]), 0 ) --- [I]0
                        
                        Input: +SYS=1,2,1,0,4,0,1[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Substring(Split(input, ",")[0],5)), ParseNumber(Split(input, ",")[1])) --- [I]1[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[1]), ParseNumber(Split(input, ",")[2])/100) --- [I]2[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[2]), ParseNumber(Split(input, ",")[3])) --- [I]1[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[3]), ParseNumber(Split(input, ",")[4])/100) --- [I]0[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[4]), 0) --- [I]4[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[5]), 0) --- [I]0[/I]
                        If (RegexMatch(input,"[Y]"), ParseNumber(Split(input, ",")[6]), 0 ) --- [I]1[/I]
                        Does this look OK?

                        Also, is my way of getting the 1st value for a +SYS input the right way to do this?

                        Many thanks
                        Richard

                        Comment


                          #13
                          And here is what I've come up for for the Names Expression:
                          Code:
                          Input: +ZST=4,1,2550,1,2530
                          If (RegexMatch(input,"[Y]"), "SYS_OnOff", Split(input, ",")[0]+ "_Mode") --- [I]+ZST=4_Mode[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_Mode", Split(input, ",")[0]+ "_SetPoint") --- [I]+ZST=4_SetPoint[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_FanSpd", Split(input, ",")[0] + "_Position") --- [I]+ZST=4_Position[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_Econ", Split(input, ",")[0] + "_CurrTemp") --- [I]+ZST=4_CurrTemp[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_FreshAir", Split(input, ",")[0] + "_Value_5") --- [I]+ZST=4_Value_5[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_Filter", Split(input, ",")[0] + "_Value_6") --- [I]+ZST=4_Value_6[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_UV", Split(input, ",")[0] + "_Value_7") --- [I]+ZST=4_Value_7[/I]
                          
                          
                          [I]Input: +SYS=1,2,1,0,4,0,1[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_OnOff", Split(input, ",")[0]+ "_Mode") --- [I]SYS_OnOff[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_Mode", Split(input, ",")[0]+ "_SetPoint") --- [I]SYS_Mode[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_FanSpd", Split(input, ",")[0] + "_Position") --- [I]SYS_FanSpd[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_Econ", Split(input, ",")[0] + "_CurrTemp") --- [I]SYS_Econ[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_FreshAir", Split(input, ",")[0] + "_Value_5") --- [I]SYS_FreshAir[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_Filter", Split(input, ",")[0] + "_Value_6") --- [I]SYS_Filter[/I]
                          If (RegexMatch(input,"[Y]"), "SYS_UV", Split(input, ",")[0] + "_Value_7") --- [I]SYS_UV[/I]

                          Looking at all these names, and considering there are 8 zones, I'm thinking it would be nice to have root devices of SYSTEM and each Zone and then all the values stored as Features under each root device.

                          I see the root device Name option in Big5 and I'm thinking something like this will work there?
                          Code:
                          If (RegexMatch(input,"[Y]"), "SYSTEM", Split(input, ",")[0])
                          But how do I then get the Names for each value to be stored under the correct root item?

                          Comment


                            #14
                            rpalmer68

                            Congratulations on the quick progress that you are making with Big5. I told you that it is not that difficult and a lot of fun :-)

                            Yes, Big5 does support Root/Features setup. It is well documented with an example in paragraph 3 of the section "HS4 specific" of the online documentation.

                            Your case is more simple as one session will create / update one root device only not 3 as it is in the example. In this regard you won't use &&& separator.

                            I would use the first one of your name expressions above as Root name expression and use the rest as Feature name expressions separated by &&.

                            Use same Value expressions as listed above separated by &&.

                            Please let us know how it goes.

                            Comment


                              #15
                              OK,

                              So I have had some success and can send commands to my aircon system and get responses back.

                              I have the Serial profile locked at the moment so it is not creating devices yet, as I want to get all the code sorted before I create a huge mess to clean up!

                              But I have hit a small road block!

                              When the system sends it's automatic status reports each second or two it seems to send a +ZST and +SYS together in one string for each Zone and then a +SYS on its own after the last zone before repeating it all again.

                              I think there is a CRLF or at least a CR between the +ZST= and +SYS= as this is what my Terminal software gives me when connected to the serial port: The extra CR/LFs weren't in the terminal windows, I have added them to show each input string
                              Code:
                              +ZST=6,2,2000,0,1866
                              +SYS=1,2,3,0,0,0,0,0
                              
                              [B]+SYS=1,2,3,0,0,0,0,0[/B]
                              
                              +ZST=1,1,2050,0,2042
                              +SYS=1,2,3,0,0,0,0,0
                              
                              +ZST=2,1,2050,0,2051
                              +SYS=1,2,3,0,0,0,0,0
                              
                              +ZST=3,1,2050,0,2042
                              +SYS=1,2,3,0,0,0,0,0
                              
                              +ZST=4,2,2000,0,1933
                              +SYS=1,2,3,0,0,0,0,0
                              
                              +ZST=5,2,2050,0,1975
                              +SYS=1,2,3,0,0,0,0,0
                              
                              +ZST=6,2,2000,0,1866
                              +SYS=1,2,3,0,0,0,0,0
                              
                              [B]+SYS=1,2,3,0,0,0,0,0[/B]
                              Which is producing this error in the Homeseer logs
                              [Big5HS4 Plugin] [SERIAL Aircon (COM1, 19200bps) IN]: +ZST=3,1,2050,0,2051 +SYS=1,2,3,0,0,0,0,0

                              Big5HS4 Error (Big5Connection) at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) at System.Double.Parse(String s) at HSPI_Big5HS4.Features.Big5ExpressionFunctions.ParseNumber(St ring str) at Flee Expression(Object , ExpressionContext , VariableCollection ) at Flee.InternalTypes.Expression`1.Evaluate() at HSPI_Big5HS4.Features.Big5Connection.EncodeStringForTransmis sion(String message, String input)
                              Big5HS4 Error (Big5Connection) Input string was not in a correct format.
                              [Big5HS4 Plugin] [ComConnection] [Raw message in]: +ZST=3,1,2050,0,2051 +SYS=1,2,3,0,0,0,0,0

                              [ComService] [Serial RAW IN]: +ZST=3,1,2050,0,2051 +SYS=1,2,3,0,0,0,0,0
                              [Big5HS4 Plugin] [SERIAL Aircon (COM1, 19200bps) IN]: +ZST=2,1,2050,0,2042 +SYS=1,2,3,0,0,0,0,0


                              NOTE: When I get the +SYS line on its own after Zone 6, Big5 does not generate any errors.

                              So I see three possible options:
                              1) Somehow split the input string into two strings and process them as per the current expressions
                              2) Drop the +SYS section of the input string when it starts with +ZST and get the +SYS update from the single +SYS sent after Zone 6
                              3) Do something else clever that you suggest

                              Here's what I currently have in the Profile boxes in case I've made a mistake in there somewhere:
                              Root Name Expresssion:
                              Code:
                              If (RegexMatch(input,"[Y]"), "SYSTEM", Split(input, ",")[0])
                              Device affect expression:
                              Code:
                              StartsWith(input, "+SYS") or StartsWith(input, "+ZST")
                              Device Name Expression: (I changed this to use StartsWith to make it clearer what it was doing.)
                              Code:
                              If (StartsWith(input, "+SYS"), "SYS_OnOff", Split(input, ",")[0]+ "_Mode") && If (StartsWith(input, "+SYS"), "SYS_Mode", Split(input, ",")[0]+ "_SetPoint") && If (StartsWith(input, "+SYS"), "SYS_FanSpd", Split(input, ",")[0] + "_Position")} && If (StartsWith(input, "+SYS"), "SYS_Econ", Split(input, ",")[0] + "_CurrTemp") && If (StartsWith(input, "+SYS"), "SYS_FreshAir", Split(input, ",")[0] + "_Value_5") && If (StartsWith(input, "+SYS"), "SYS_Filter", Split(input, ",")[0] + "_Value_6") && If (StartsWith(input, "+SYS"), "SYS_UV", Split(input, ",")[0] + "_Value_7")
                              Device Value Expression:
                              Code:
                              If (StartsWith(input, "+SYS"), ParseNumber(Substring(Split(input, ",")[0],5)), ParseNumber(Split(input, ",")[1]))} && If (StartsWith(input, "+SYS"), ParseNumber(Split(input, ",")[1]), ParseNumber(Split(input, ",")[2])/100) && If (StartsWith(input, "+SYS"), ParseNumber(Split(input, ",")[2]), ParseNumber(Split(input, ",")[3])) && If (StartsWith(input, "+SYS"), ParseNumber(Split(input, ",")[3]), ParseNumber(Split(input, ",")[4])/100) && If (StartsWith(input, "+SYS"), ParseNumber(Split(input, ",")[4]), 0) && If (StartsWith(input, "+SYS"), ParseNumber(Split(input, ",")[5]), 0) && If (StartsWith(input, "+SYS"), ParseNumber(Split(input, ",")[6]), 0 )

                              Comment

                              Working...
                              X