No announcement yet.

Alarm panel

  • Filter
  • Time
  • Show
Clear All
new posts

    Alarm panel


    I have an alarm panel publishing a JSON payload for open zones with comma separated numbers.

    I would like to substitute each number with the name of the zone to display status by name.
    To do this with VSP’s there are too many combinations.

    Click image for larger version

Name:	alarm2.png
Views:	63
Size:	9.8 KB
ID:	1409841Click image for larger version

Name:	alarm.png
Views:	45
Size:	9.9 KB
ID:	1409842

    How would I go about doing this?


    Use the Edit tab to select a Control/Status UI type of CSV. This should create a HS device for each comma-separated value in your payload. It will give names something like CSV1, CSV2 etc. You will need to manually changed the name in HS Device Management.


      I have already tried that, the problem is that when all zones are closed the HS devices that were opened do not change status


        Are you indicating that if you start with a payload of [0,0,0] there will be three HS devices with values of 0, 0 and 0. If you then received a payload of [1,1,1] that the HS devices do not change their DeviceValue? Does the DeviceString change?


          The payload with all zones closed is [ ] each zone that opens will add a value for each open zone so for 3 zones it will be [x ,y ,z] if one of the zones is closed it will be [x ,y] and when all the zones are closed it will be [ ] again.


            You have a very specialized situation that you will need to handle in a script. You can select the Control/Status UI type of Text and the data received with be in the DeviceString. Use an event to trigger on the MQTT topic. The action will be to invoke your script that will parse the DeviceString. If you need help with script then specify what you want to happen when a change occurs.


              I would appreciate help with a script.
              What I want to see is a text status for each zone for example for [x ,y ,z] the HS device would display text1 ,text2, text3 and none for all zones closed.


                It is still not clear to me. You would like a single HS device that shows in the DeviceString something like


                If this is the case then how may zones are being monitored? what is the relationship between x and text1,text2, or text3?

                Another possibility is that if you have, for example, 8 zones then create 8 devices and the Device will show some text or be blank based upon the last received MQTT message.


                  I have 22 zones so if all the zones appeared in a single DeviceString it would be too long, what I would like to do is to substitute a name for each number:
                  so if zones [1 ,2 ,3] are open the text would be text1 ,text2 ,text3 and if zones [4 ,5 ,6] were open the text would be text4 ,text5 ,text6 or if zones [1 ,3 ,6] the text would be text1 ,text3 ,text6.

                  Ideally I would like to see for 0 open zones show nothing or the text "none" for 1 open zone "textX" for 2 open zones "textX ,textY" for 3 open zones "textX, textY, textZ" and so on.

                  If that is not an option having for example 4 HS devices that would change for each open zone and show nothing when all zones are closed.


                    So really all you are looking for is a substitution of number 3 with a name text3. It may be able to be done with the Replace expression function already in mcsMQTT or regular expression one. I need to confirm with test. If not then a script will do it. I will get to it later today.


                      I performed the test with success. The only constraint is that you cannot use numbers in your zone names. The example below in the code block covers zones 1,11,21 and 22. You can use this pattern to do all 22 zones. This means you will have 22 "Replace(" strings at the start of the line. Do this in a text editor and them past the long string in the text box. Go in decreasing order starting at 22 with the last one being 1.

                      The Expression I used for testing is below. It takes the payload and replaces any 22 values with the name Z. Any 21 values with name Y, etc. Choose your own names rather than Z, Y, etc. The expression is entered on the Edit tab as shown in the screenshot.

                      Click image for larger version

Name:	Capture4.PNG
Views:	28
Size:	93.3 KB
ID:	1410004

                      I testing with a message with three items in the payload. The plugin does the substitution and puts the result in the HS device string. Screenshots below.
                      Click image for larger version

Name:	Capture2.PNG
Views:	44
Size:	18.3 KB
ID:	1410002
                      Click image for larger version

Name:	Capture1.PNG
Views:	42
Size:	39.7 KB
ID:	1410003


                        Thanks Michael! Working perfectly