{"id":3689,"date":"2018-09-13T15:54:58","date_gmt":"2018-09-13T15:54:58","guid":{"rendered":"http:\/\/grodansparadis.com\/wordpress\/?p=3689"},"modified":"2018-09-13T19:28:12","modified_gmt":"2018-09-13T19:28:12","slug":"howto-sms-alarms","status":"publish","type":"post","link":"https:\/\/grodansparadis.com\/wordpress\/?p=3689","title":{"rendered":"HowTo: SMS Alarms"},"content":{"rendered":"\r\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"1031\" data-attachment-id=\"3690\" data-permalink=\"https:\/\/grodansparadis.com\/wordpress\/?attachment_id=3690\" data-orig-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180907_015349988.jpg?fit=3006%2C5344&amp;ssl=1\" data-orig-size=\"3006,5344\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;XT1562&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1536285230&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.67&quot;,&quot;iso&quot;:&quot;1600&quot;,&quot;shutter_speed&quot;:&quot;0.06666&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"IMG_20180907_015349988\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180907_015349988.jpg?fit=576%2C1024&amp;ssl=1\" class=\"wp-image-3690\" src=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180907_015349988.jpg?resize=580%2C1031\" alt=\"\" srcset=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180907_015349988.jpg?w=3006&amp;ssl=1 3006w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180907_015349988.jpg?resize=169%2C300&amp;ssl=1 169w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180907_015349988.jpg?resize=768%2C1365&amp;ssl=1 768w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180907_015349988.jpg?resize=576%2C1024&amp;ssl=1 576w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180907_015349988.jpg?w=1160&amp;ssl=1 1160w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180907_015349988.jpg?w=1740&amp;ssl=1 1740w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">The problem<\/h2>\r\n\r\n\r\n\r\n\r\nJust last week a house burned down to the ground here in my hometown. The family of two adults and three kids just made it out. This reminded me of the importance of alarms. My family as any family I guess have had some incidents over the year. In our case with a four floor building, cellar, office, apartment where we live and the attic it can be hard to, despite alarm equipment, to recognize what is happening in the cellar when your are in the apartment watching a film or even worse, sleeping. We have had our incident over the years as most people do.\r\n\r\n\r\n\r\n\r\n\r\nI use VSCP here of course. This system is intelligent enough to close down functionality\u00a0 when things get bad. But a few weeks ago I had a bad incident. I have a VSCP node that control the water boiler in the cellar for warm water. This is a very simple setup. A relay, a sensor and a control node. I can thus remotely control sense and control the temperature of the hot water in the house.\r\n\r\n\r\n\r\n\r\n\r\nSitting in the office I noticed a strange sound. I usually play music loud so it had been going on for some time I guess. I went around the house investigating the sound and when I came down to the cellar I heard that the boiler literally boiled hard. Not a good thing. There is a risk for a steam explosion from this so I got really worried.\r\n\r\n\r\n\r\n\r\n\r\nI turned of the power. Opened valves for hot water in the office and got steam and boiling water coming out. I checked the control unit and it had turned of the relay. Still the temperature was way over the limit. There is an independent security unit inside the boiler that should turn off power when it get over a certain temperature. Apparently this mechanism had not done it&#8217;s job. Also the security valve that prevent to hot water from going out in the system also malfunctioned otherwise I should not have got steam hot water out of the office valve. Two faults. The pressure security mechanism on the other side worked. But the boiler never got up to the 10 bar needed to release it. So things were actually not to bad. Bit could gone worse if I had been away for example.\r\n\r\n\r\n\r\n\r\n\r\nI later checked the cause and detected that the relays had gone stuck in the on position.\u00a0 Something that happen to relays some times when load is heavy or control is a bit jumpy.\u00a0 I also tested the overheat protection and it worked as it should, probably it would have just needed a bit more time to cut the power. The blender protecting the water line from to hot water was the only faulty component. Still this was a bit scary. I need to be alarmed if this happen again.\r\n\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">GSM Modem<\/h2>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"326\" data-attachment-id=\"3692\" data-permalink=\"https:\/\/grodansparadis.com\/wordpress\/?attachment_id=3692\" data-orig-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101018853.png?fit=1280%2C719&amp;ssl=1\" data-orig-size=\"1280,719\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"IMG_20180913_101018853\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101018853.png?fit=580%2C326&amp;ssl=1\" class=\"wp-image-3692\" src=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101018853.png?resize=580%2C326\" alt=\"\" srcset=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101018853.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101018853.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101018853.png?resize=768%2C431&amp;ssl=1 768w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101018853.png?resize=1024%2C575&amp;ssl=1 1024w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101018853.png?w=1160&amp;ssl=1 1160w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/figure>\r\n\r\n\r\n\r\n\r\nI previously sold professional GPRS modems in the FrogShop from <a href=\"http:\/\/www.caimore.net\/\">Caimore<\/a>. Still have some around so I decided to put one to work. You can find may similar on Aliexpress or <a href=\"https:\/\/www.ebay.com\/itm\/GSM-Modem-Wavecom-Q2303A-Module-COM-RS232-Serial-Port-AT-Commands-SMS-Voice-Call\/272225402538?hash=item3f61e5feaa:g:eCgAAMXQUmFSe2mo\">ebay.<\/a> and even <a href=\"https:\/\/www.ebay.com\/itm\/SIM800L-GPRS-GSM-Module-SIM-Board-Quadband-L-shape-Antenna-For-MCU-Arduino\/263617797848?hash=item3d60d85ed8:m:mazp_SyChZP5klsDZkaUcaw\">lower cost modules<\/a> intended for Arduino or similar as the one below. They all have there pros and cons.\r\n\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"326\" data-attachment-id=\"3691\" data-permalink=\"https:\/\/grodansparadis.com\/wordpress\/?attachment_id=3691\" data-orig-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101333825_HDR.png?fit=1280%2C719&amp;ssl=1\" data-orig-size=\"1280,719\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"IMG_20180913_101333825_HDR\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101333825_HDR.png?fit=580%2C326&amp;ssl=1\" class=\"wp-image-3691\" src=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101333825_HDR.png?resize=580%2C326\" alt=\"\" srcset=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101333825_HDR.png?w=1280&amp;ssl=1 1280w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101333825_HDR.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101333825_HDR.png?resize=768%2C431&amp;ssl=1 768w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101333825_HDR.png?resize=1024%2C575&amp;ssl=1 1024w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_101333825_HDR.png?w=1160&amp;ssl=1 1160w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">SIM Card<\/h2>\r\n\r\n\r\n\r\n\r\nNext thing is to find a SIM card. In Sweden this is not a simple thing if you just want a module that sends a few SMS&#8217;s per year. The solutions available are highly overpriced. I know there are other and better options available in other countries. I just select a cash card to get started.\r\n\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">Software<\/h2>\r\n\r\n\r\n\r\n\r\nInitially I thought about writing a driver for the VSCP daemon and this may still be an option, we will see. I have for a long time used <a href=\"http:\/\/smstools3.kekekasvi.com\">Smstools<\/a> a wonderful package for uses like this. With the help of the decision matrix of the VSCP daemon it will be possible to do plenty without a driver. So this is the solution I go for.\r\n\r\n\r\n\r\n\r\n\r\nThere is a nice getting started <a href=\"https:\/\/www.20papercups.net\/programming\/sending-receiving-sms-on-linux\/\">tutorial for smstools here<\/a>. Thus no need for me to write one again.\r\n\r\n\r\n\r\n\r\n\r\nThe only thing i ned to do to get things working is to set the <strong>device<\/strong> and the <strong>baudrate<\/strong> lines in <strong>\/etc\/smsd.conf<\/strong> file\r\n\r\n\r\n\r\n\r\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">device = \/dev\/ttyUSB0<\/blockquote>\r\n\r\n\r\n\r\n\r\nas I use an USB adapter for serial communication.\r\n\r\n\r\n\r\n\r\n\r\nAnd\r\n\r\n\r\n\r\n\r\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">baudrate = 115200<\/blockquote>\r\n\r\n\r\n\r\n\r\nas i use that higher speed.\r\n\r\n\r\n\r\n\r\n\r\nThen I just restart the smsd daemon with\r\n\r\n\r\n\r\n\r\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">sudo service smsd restart<\/blockquote>\r\n\r\n\r\n\r\n\r\nand everything is working.\r\n\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">Sending SMS&#8217;s<\/h2>\r\n\r\n\r\n\r\n\r\nWe are just interested in sending SMS&#8217;s here so we stick to that. But receiving SMS&#8217;s (we look at that in a later post) is also equally simple.\r\n\r\n\r\n\r\n\r\n\r\nTo send a SMS one just copy a formated file into the folder \/var\/spool\/smsd\/outgoing. So to send an SMS to +467012345678 one send a file\r\n\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">To: 467012345678<\/pre>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">ALARM: The water in the boiler is way to hot!<\/pre>\r\n\r\n\r\n\r\n\r\nWrite this to a file and copy it to <strong>\/var\/spool\/smsd\/outgoing<\/strong> and the SMS will be delivered to the set recipient.\r\n\r\n\r\n\r\n\r\n\r\nYou can set the header to\r\n\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">To: 467012345678\r\nFlash: yes\r\n\r\nALARM: The water in the boiler is way to hot!<\/pre>\r\n\r\n\r\n\r\n\r\nto send a flash SMS (is displayed on the users screen directly but not saved). It can hardly be simpler.\r\n\r\n\r\n\r\n\r\n<h4 class=\"wp-block-heading\">Voicecall<\/h4>\r\n\r\n\r\n\r\n\r\nAnother possibility is to make a call to a receiver instead. Add <strong>Voicecall<\/strong> to the header like this\r\n\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">To: 46730533146\r\nVoicecall: yes<\/pre>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">TONE: 5 #,#,#<\/pre>\r\n\r\n\r\n\r\n\r\nHere the mentioned precipitant will receive a call and when answered five groups of three &#8220;#&#8221; DTMF tons will be sounded. Tones that can be used to tell the recipient about the cause of the alarm. I will for instance use the number of &#8220;#&#8221; sounds as an indication of what floor the alarm happened. Possible with different tones for different alarms.\r\n\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"522\" data-attachment-id=\"3207\" data-permalink=\"https:\/\/grodansparadis.com\/wordpress\/?attachment_id=3207\" data-orig-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/vscp_logo_text_box-1-1-1-1.png?fit=800%2C720&amp;ssl=1\" data-orig-size=\"800,720\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"vscp_logo_text_box-1-1-1-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/vscp_logo_text_box-1-1-1-1.png?fit=580%2C522&amp;ssl=1\" class=\"wp-image-3207\" src=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/vscp_logo_text_box-1-1-1-1.png?resize=580%2C522\" alt=\"\" srcset=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/vscp_logo_text_box-1-1-1-1.png?w=800&amp;ssl=1 800w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/vscp_logo_text_box-1-1-1-1.png?resize=300%2C270&amp;ssl=1 300w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/02\/vscp_logo_text_box-1-1-1-1.png?resize=768%2C691&amp;ssl=1 768w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">vscpd and smstools<\/h2>\r\n\r\n\r\n\r\n\r\nSo now lets put this to work for our VSCP based system.\r\n\r\n\r\n\r\n\r\n\r\nAlarm related events is collected in the class <a href=\"https:\/\/grodansparadis.gitbooks.io\/the-vscp-specification\/class1.alarm.html\">CLASS1.ALARM<\/a>. The <a href=\"https:\/\/grodansparadis.gitbooks.io\/the-vscp-specification\/class1.alarm.html#type2\">CLASS1.ALARM, Type=2, Alarm occurred<\/a> is intended for alarm conditions.\u00a0 So if we let sensors that generate alarms send this event and trigger on it in the decision matrix of the VSCP daemon we can send our SMS and voicecalls from there. The <strong>zone<\/strong> and <strong>subzone<\/strong> can be used as markers for where the alarm occurred. The originating GUID can also be used to identify this.\r\n\r\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;row enable=&quot;true&quot; groupid=&quot;alarm&quot; &gt;\r\n\r\n\t&lt;comment&gt;Send alarm.&lt;\/comment&gt;\r\n\t\r\n\t&lt;mask priority=&quot;0&quot; class=&quot;65535&quot; type=&quot;65535&quot; guid=&quot;00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00&quot; &gt;\r\n\t&lt;\/mask&gt;\r\n\t\r\n\t&lt;filter priority=&quot;0&quot; class=&quot;1&quot; type=&quot;2&quot; guid=&quot;00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00&quot; &gt; \r\n\t&lt;\/filter&gt;\r\n\t\r\n\t&lt;action&gt;0x10&lt;\/action&gt;\r\n\t&lt;param &gt;\/home\/vscp\/doalarm.py %zone %subzone event.guid %isodate %isotime &quot;Current boiler temp is %vardecode:&#x5B;boiler-temp]&quot;&lt;\/param&gt;\r\n\t\r\n\t&lt;allowed_from&gt;0000-01-01 00:00:00&lt;\/allowed_from&gt;\r\n\t&lt;allowed_to&gt;9999-12-31 23:59:59&lt;\/allowed_to&gt;\r\n\t&lt;allowed_weekdays&gt;mtwtfss&lt;\/allowed_weekdays&gt;\r\n\t&lt;allowed_time&gt;*-*-* *:*:*&lt;\/allowed_time&gt;\r\n&lt;\/row&gt;\r\n<\/pre>\r\n\r\n\r\n\r\n\r\n\r\nSo what do we have here?\r\n\r\n\r\n\r\n\r\n\r\nWe trigger on any alarm occurred event regardless of priority and from which originating GUID (which unit) it comes from. It would have been possible to do several DM rows for different GUID&#8217;s (originating nodes) of course to handle alarms from them different.\r\n\r\n\r\n\r\n\r\n\r\nThe time block (form &lt;allowed from&gt; to the end) just say that this can happen anytime. Leaving this block out has the same meaning.\r\n\r\n\r\n\r\n\r\n\r\nAnd last the important action.\u00a0 In this case, execute external program (<strong>0x10<\/strong>) and in the parameter for the action the actual program to execute is specified with the path to it (<strong>\/home\/vscp\/doalarm.py<\/strong>) is given. The rest of the action parameter line is arguments to this external program.\r\n\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n \t<li><strong>%event.zone <\/strong>&#8211; Zone for alarm event.<\/li>\r\n \t<li><strong>%event.subzone <\/strong>&#8211; Subzone for alarm event.<\/li>\r\n \t<li><strong>%event.guid<\/strong> &#8211; GUID for alarm event.<\/li>\r\n \t<li><strong>%isodate<\/strong> &#8211; Date on ISO format for alarm.<\/li>\r\n \t<li><strong>%isotime<\/strong> &#8211; Time on ISO format for alarm.<\/li>\r\n \t<li><strong>%vardecode:[<\/strong>\/\/alarmtext\/\/<strong>]<\/strong> &#8211; Specific text for alarm.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n\r\nThe description of the decision matrix is <a href=\"https:\/\/grodansparadis.gitbooks.io\/the-vscp-daemon\/decision_matrix.html\">here<\/a>.\r\n\r\n\r\n\r\n\r\n\r\n<strong>Zone<\/strong> and <strong>subzone<\/strong> is numericals that can be used to specify the place and equipment that generated the alarm. I have floor plan in zone and a room on that floor plan in subzone.\r\n\r\n\r\n\r\n\r\n\r\nThe <strong>vardecode<\/strong> writes out the content of the given variable if it is present. We will come back to it later.\r\n\r\n\r\n\r\n\r\n\r\nWhen this row is added the external script will be executed when <a href=\"https:\/\/grodansparadis.gitbooks.io\/the-vscp-specification\/class1.alarm.html#type2\">CLASS1.ALARM, TYPE=2<\/a> is generated by a node and received by the VSCP daemon.\r\n\r\n\r\n\r\n\r\n\r\nIt is good if the script can do both voice calls and SMS sends and that both can be sent to a list of numbers.\r\n\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">The doalarm.py script<\/h2>\r\n\r\n\r\n\r\n\r\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport sys\r\nimport uuid\r\n\r\nfilename_voice = str(uuid.uuid4())\r\nfilename_sms = str(uuid.uuid4())\r\n\r\n# Dir that holds outgoing SMS messages\r\nOUTDIR=&quot;\/var\/spool\/sms\/outgoing&quot;\r\n\r\n# Voicel recipients (comma separated list, empty for non)\r\nVOICE_RECEIVERS=&quot;4673xxxxxxxx,4676yyyyyyyyy&quot;\r\n\r\n# Set to true for flash SMS\r\nbflash = False\r\n\r\n# SMS recipients (comma eparated list, empty for non )\r\n#SMS_RECEIVERS=&quot;4673xxxxxxxx,4676yyyyyyyyy&quot;\r\nSMS_RECEIVERS=&quot;&quot;\r\n\r\nSMS_TEXT=&quot;An alarm condition has occured!&quot;\r\n\r\n# -----------------------------------------------------------------------------\r\n\r\nvoicetone=&quot;5 &quot;\r\nfor x in range(0, int( sys.argv&#x5B;1] ) ):\r\n\tvoicetone = voicetone + &quot;1,&quot;\r\n\r\nvoiceRcvList = VOICE_RECEIVERS.split(&quot;,&quot;)\r\n\r\ncnt=0\r\nif VOICE_RECEIVERS != &quot;&quot; :\r\n\tfor receiver in voiceRcvList:\r\n\t\tprint( OUTDIR + &quot;\/&quot; + filename_voice + str(cnt) )\r\n\t\twith open( OUTDIR + &quot;\/&quot; + filename_voice + str(cnt), &quot;w&quot;) as text_file:\r\n\t\t\ttext_file.write( &quot;To: {0}\\n&quot;.format(receiver) )\r\n\t\t\ttext_file.write( &quot;Voicecall: yes\\n\\n&quot; )\r\n\t\t\ttext_file.write( voicetone )\r\n\t\tcnt = cnt + 1\r\n\r\nSMSRcvList = SMS_RECEIVERS.split(&quot;,&quot;)\r\n\r\nif SMS_RECEIVERS != &quot;&quot; :\r\n\tfor receiver in SMSRcvList:\r\n\t\tprint( OUTDIR + &quot;\/&quot; + filename_voice + str(cnt) )\r\n\t\twith open( OUTDIR + &quot;\/&quot; + filename_voice + str(cnt), &quot;w&quot;) as text_file:\r\n\t\t\ttext_file.write( &quot;To: {0}\\n&quot;.format(receiver) )\r\n\t\t\tif bflash:\r\n\t\t\t\ttext_file.write( &quot;Flash: yes\\n&quot; )\r\n\t\t\ttext_file.write( &quot;\\n\\n&quot; )\r\n\t\t\ttext_file.write( SMS_TEXT+&quot;\\n&quot; )\r\n\t\t\ttext_file.write( &quot;Zone={0} SubZone={1} Time={2} Date={3}\\n&quot;.format(sys.argv&#x5B;1],sys.argv&#x5B;2],sys.argv&#x5B;3],sys.argv&#x5B;4] ) )\r\n\t\t\ttext_file.write( &quot;{0}&quot;.format(sys.argv&#x5B;5]) )        \r\n\t\tcnt = cnt + 1\r\n<\/pre>\r\n\r\n\r\n\r\n\r\n\r\nThis is the script. It is written i Python to make things simple to edit and\/or change. You can find the script in <a href=\"https:\/\/github.com\/grodansparadis\/vscp\/tree\/master\/src\/vscp\/samples\/smstools\">the VSCP repository<\/a>.\r\n\r\n\r\n\r\n\r\n\r\nJust edit the variables in the beginning of the script to fit your setup and you are set to go.\r\n\r\n\r\n\r\n\r\n\r\nNote that the voice call will do five groups of a series of &#8220;1&#8221;-press DTMF where the count is the same as the supplied zone parameter. In my case this is the floor plan so I know instantly where something happened and runa way and fix it. The SMS also give me more info.\r\n\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">The variable<\/h2>\r\n\r\n\r\n\r\n\r\nTo come back to the variable that is sent as a parameter. Perfect is to save a\u00a0 measurement value in another part of the DM. Like this\r\n\r\n\r\n\r\n\r\n\r\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;row enable=&quot;true&quot; groupid=&quot;temperature&quot; &gt;\r\n    &lt;mask priority=&quot;0&quot; class=&quot;65535&quot; type=&quot;65535&quot; GUID=&quot;FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF&quot; &gt; &lt;\/mask&gt;\r\n    &lt;filter priority=&quot;0&quot; class=&quot;10&quot; type=&quot;6&quot; GUID=&quot;FF:FF:FF:FF:FF:FF:FF:FF:3C:00:08:01:92:9D:3D:10&quot; &gt; &lt;\/filter&gt;\r\n    &lt;action&gt;80&lt;\/action&gt;\r\n    &lt;param&gt;boiler-temp;float;true;0;0x777;%measurement.float&lt;\/param&gt;\r\n    &lt;comment&gt;Store boiler temperature in variable&lt;\/comment&gt;\r\n    &lt;allowed_from&gt;0000-01-01 00:00:00&lt;\/allowed_from&gt;\r\n    &lt;allowed_to&gt;9999-12-31 23:59:59&lt;\/allowed_to&gt;\r\n    &lt;allowed_weekdays&gt;mtwtfss&lt;\/allowed_weekdays&gt;\r\n    &lt;allowed_time&gt;*-*-* *:*:*&lt;\/allowed_time&gt;\r\n&lt;\/row&gt;<\/pre>\r\n\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">An alternative way to do it<\/h2>\r\n\r\n\r\n\r\n\r\nAnother way is to do measurement compares, as in this case check the boiler temperature, you can read <a href=\"http:\/\/grodansparadis.com\/wordpress\/?p=2917\">more about this method here <\/a>and it is in many ways the same as the one we described above but more specific for boiler temp alarm.\r\n\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">And next?<\/h2>\r\n\r\n\r\n\r\n\r\nNow you should be able to add your own alarms to your VSCP setup. Maybe something that will do good work in your remote cottage, alarming\u00a0 freezing conditions before bad and costly things happens. In my house we will now sleep much better knowing that we will get alarms when things go wrong.\r\n\r\n\r\n\r\n\r\n\r\nI promised to continue with a follow up on how to react on incoming SMS mesages. This makes it possible to remotely control things as well such as turning on the heat in that remote cottage I mentioned above. I will try to write that story up soon. Time is my enemy, or rather lack of it.\r\n\r\n\r\n\r\n\r\n\r\nCheers\r\n\/<strong>Ake<\/strong>\r\n\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"1033\" data-attachment-id=\"3700\" data-permalink=\"https:\/\/grodansparadis.com\/wordpress\/?attachment_id=3700\" data-orig-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_094253218.png?fit=719%2C1280&amp;ssl=1\" data-orig-size=\"719,1280\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"IMG_20180913_094253218\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_094253218.png?fit=575%2C1024&amp;ssl=1\" class=\"wp-image-3700\" src=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_094253218.png?resize=580%2C1033\" alt=\"\" srcset=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_094253218.png?w=719&amp;ssl=1 719w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_094253218.png?resize=169%2C300&amp;ssl=1 169w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2018\/09\/IMG_20180913_094253218.png?resize=575%2C1024&amp;ssl=1 575w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/figure>\r\n\r\n\r\n\r\n\r\n&nbsp;\r\n\r\n\r\n\r\n\r\n\r\n&nbsp;\r\n\r\n","protected":false},"excerpt":{"rendered":"<p>The problem Just last week a house burned down to the ground here in my hometown. The family of two adults and three kids just made it out. This reminded me of the importance of alarms. My family as any family I guess have had some incidents over the year. In our case with a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[53,13],"tags":[],"class_list":["post-3689","post","type-post","status-publish","format-standard","hentry","category-howtos","category-vscp"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4raCZ-Xv","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3689"}],"version-history":[{"count":10,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3689\/revisions"}],"predecessor-version":[{"id":3723,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3689\/revisions\/3723"}],"wp:attachment":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}