From version 13.1.1.4 a new more deterministic way is used to generate automatic client id’s. VSCP daemon internal events will use id’s from the high part of the client id that will always be the same.
Client id’s for drivers and other configuration parts that before was generated from the order the item was loaded also now work that way If the client id part of a GUID is zero (byte 12/13). If however it is not AND the client id is not already used in the system the VSCP daemon will use the set client id for the item.
This means that drivers with set GUID’s will always have the same interface GUID being more deterministic. tcp/op connections, websocket connections rest i/f connections will be assigned client id’s on the go as before.
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 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.
I use VSCP here of course. This system is intelligent enough to close down functionality 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.
Sitting 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.
I 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’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.
I later checked the cause and detected that the relays had gone stuck in the on position. Something that happen to relays some times when load is heavy or control is a bit jumpy. 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.
GSM Modem
I previously sold professional GPRS modems in the FrogShop from Caimore. Still have some around so I decided to put one to work. You can find may similar on Aliexpress or ebay. and even lower cost modules intended for Arduino or similar as the one below. They all have there pros and cons.
SIM Card
Next 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’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.
Software
Initially 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 Smstools 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.
There is a nice getting started tutorial for smstools here. Thus no need for me to write one again.
The only thing i ned to do to get things working is to set the device and the baudrate lines in /etc/smsd.conf file
device = /dev/ttyUSB0
as I use an USB adapter for serial communication.
And
baudrate = 115200
as i use that higher speed.
Then I just restart the smsd daemon with
sudo service smsd restart
and everything is working.
Sending SMS’s
We are just interested in sending SMS’s here so we stick to that. But receiving SMS’s (we look at that in a later post) is also equally simple.
To 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
To: 467012345678
ALARM: The water in the boiler is way to hot!
Write this to a file and copy it to /var/spool/smsd/outgoing and the SMS will be delivered to the set recipient.
You can set the header to
To: 467012345678
Flash: yes
ALARM: The water in the boiler is way to hot!
to send a flash SMS (is displayed on the users screen directly but not saved). It can hardly be simpler.
Voicecall
Another possibility is to make a call to a receiver instead. Add Voicecall to the header like this
To: 46730533146
Voicecall: yes
TONE: 5 #,#,#
Here the mentioned precipitant will receive a call and when answered five groups of three “#” 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 “#” sounds as an indication of what floor the alarm happened. Possible with different tones for different alarms.
vscpd and smstools
So now lets put this to work for our VSCP based system.
Alarm related events is collected in the class CLASS1.ALARM. The CLASS1.ALARM, Type=2, Alarm occurred is intended for alarm conditions. 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 zone and subzone can be used as markers for where the alarm occurred. The originating GUID can also be used to identify this.
So what do we have here?
We 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’s (originating nodes) of course to handle alarms from them different.
The time block (form <allowed from> to the end) just say that this can happen anytime. Leaving this block out has the same meaning.
And last the important action. In this case, execute external program (0x10) and in the parameter for the action the actual program to execute is specified with the path to it (/home/vscp/doalarm.py) is given. The rest of the action parameter line is arguments to this external program.
%event.zone – Zone for alarm event.
%event.subzone – Subzone for alarm event.
%event.guid – GUID for alarm event.
%isodate – Date on ISO format for alarm.
%isotime – Time on ISO format for alarm.
%vardecode:[//alarmtext//] – Specific text for alarm.
The description of the decision matrix is here.
Zone and subzone 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.
The vardecode writes out the content of the given variable if it is present. We will come back to it later.
When this row is added the external script will be executed when CLASS1.ALARM, TYPE=2 is generated by a node and received by the VSCP daemon.
It is good if the script can do both voice calls and SMS sends and that both can be sent to a list of numbers.
The doalarm.py script
import sys
import uuid
filename_voice = str(uuid.uuid4())
filename_sms = str(uuid.uuid4())
# Dir that holds outgoing SMS messages
OUTDIR="/var/spool/sms/outgoing"
# Voicel recipients (comma separated list, empty for non)
VOICE_RECEIVERS="4673xxxxxxxx,4676yyyyyyyyy"
# Set to true for flash SMS
bflash = False
# SMS recipients (comma eparated list, empty for non )
#SMS_RECEIVERS="4673xxxxxxxx,4676yyyyyyyyy"
SMS_RECEIVERS=""
SMS_TEXT="An alarm condition has occured!"
# -----------------------------------------------------------------------------
voicetone="5 "
for x in range(0, int( sys.argv[1] ) ):
voicetone = voicetone + "1,"
voiceRcvList = VOICE_RECEIVERS.split(",")
cnt=0
if VOICE_RECEIVERS != "" :
for receiver in voiceRcvList:
print( OUTDIR + "/" + filename_voice + str(cnt) )
with open( OUTDIR + "/" + filename_voice + str(cnt), "w") as text_file:
text_file.write( "To: {0}\n".format(receiver) )
text_file.write( "Voicecall: yes\n\n" )
text_file.write( voicetone )
cnt = cnt + 1
SMSRcvList = SMS_RECEIVERS.split(",")
if SMS_RECEIVERS != "" :
for receiver in SMSRcvList:
print( OUTDIR + "/" + filename_voice + str(cnt) )
with open( OUTDIR + "/" + filename_voice + str(cnt), "w") as text_file:
text_file.write( "To: {0}\n".format(receiver) )
if bflash:
text_file.write( "Flash: yes\n" )
text_file.write( "\n\n" )
text_file.write( SMS_TEXT+"\n" )
text_file.write( "Zone={0} SubZone={1} Time={2} Date={3}\n".format(sys.argv[1],sys.argv[2],sys.argv[3],sys.argv[4] ) )
text_file.write( "{0}".format(sys.argv[5]) )
cnt = cnt + 1
This is the script. It is written i Python to make things simple to edit and/or change. You can find the script in the VSCP repository.
Just edit the variables in the beginning of the script to fit your setup and you are set to go.
Note that the voice call will do five groups of a series of “1”-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.
The variable
To come back to the variable that is sent as a parameter. Perfect is to save a measurement value in another part of the DM. Like this
Another way is to do measurement compares, as in this case check the boiler temperature, you can read more about this method here and it is in many ways the same as the one we described above but more specific for boiler temp alarm.
And next?
Now 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 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.
I 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.
Cheers
/Ake
I am building new control hardware for our heating system at the moment (the HULK). This is the third generation and it is VSCP based of course. Will document as a demo later.
It is VSCP‘s 18th birthday today. That is a a long time. At least for me, the (main) developer. There is enormous amounts of time put down into this project. Crazy amounts of hours. Every release gets around three, in best case up to ten downloads. That makes it worth it. That and the sheer happiness to truly believe in something.
The thought was that I would do the 13.1.0 release today. But I have to postpone this until after my summer vacation. Well it to should have started today, but it also is postponed until Tuesday. But then I will be four weeks away from the computers and the bugs. It is very warm and dry in Sweden now, and has been so since May, and actually an office is NOT the place to be.
I work with a full Debian package for VSCP at the moment. It is a lot of rules. A lot of info to take in. A lot of things to add and change. After this is finished I will hopefully manage to get a sponsor/mentor at Debian and after that VSCP can enter in the golden path of Debian distribution, meaning much simpler installation and update for all in the future.
So I will silence for a while from now on so don’t expect rapid replies and fixes during this time. Hopefully I will come back after the vacation with a lot of new energy.
All files generated contains version information which is the date and time when the docs was generated. This information is embedded in the generated files (if possible) and also available in JSON form here (version.json) and in JSONP form here (version.jsonp). In automated processes compare the on-site version information in one of there file with the downloaded version and download a new version if a newer one is available.
It’ been quiet on all VSCP fronts for a while. Well VSCP is anyway probably the least written about project in the world in relation to time alive and efforts put into it. And that is OK as long as things move forward (and they do – slowly).
We approach 18 years of VSCP now in August. I never could see that coming when I started this project. I think I have worked almost daily during this time on the project. Crazy if you think about it.
A lot of other projects has emerged (and died) now with the buzz of IoT. It’s a bit like waves of knowledge coming to people unused to embedded development who never ask questions to people that has been into embedded development for ages. First everything should connect to the cloud, then people realised that that was not the best solution, it was impossible to realize actually, border routers was introduced, we called them (home) gateways before, then web standards where abandoned for binary protocols and so on. Soon someone will realize that things will we both wireless and connected with cables and that small devices really have limited resources and then we probably end up in something like what VSCP has been about all the time. Well, it’s the way things work in our industry. Hype, hype, hype. Happy, happy, sad.
Here is the current state.
TSL/SSL
OK VSCP. Changes has been made to the VSCP daemon. The mongoose tcp/ip code is on the way out and is replaced with some code derived from the Civetweb project. A fun thing is that this derived code is also the ancestor to the Mongoose code to. Good thing is that now all the VSCP Daemon code will be MIT licensed. Freedom for you.
The derived code is published as a separate project sockettcp (still needs to be documented) and this is code that makes it easy to code tcp clients/servers that use TSL/SSL or unsecure connections. Works on Windows and Linux.
The VSCP Daemon tcp/ip interface will therefore be fully TLS/SSL from the next version.
Encryption will also be introduced in another layer to both the winsock and the tcp/ip interfaces. Much like what is available today in the multicast and UDP interfaces. This makes it possible for clients that don’t have the ower to use full TSL/SSL to still implement secure connections.
VSCP Daemon
Yes I changed the name to “VSCP Server” for a while. Just like “VSCP Dameon” better. so I changed back. Probably will use the term “Border Router” for this piece of software more in the future.
Documentation
Most if the documentation (still some work left to do on VSCP Works) has now been moved to Markdown and is available on Gitbook (old paths work). Docs are licensed under Creative Commons BY 4.0 now. Search and pdf/ebook availabilities is the good things that come with this change. Source for the docs are available on Github (vscp-doc-….) and it is now easy to post corrections and changes as for all Git projects.
Specs
To add classes and types has been something that has been getting harder and harder over time. The defines for them are all over the place. A change/addition means editing all these places. This has been changed now so all files are auto-generated including the class/type part of the VSCP spec. JSON/XML/sql… and other formats will be available soon for dynamic downloads.
Well there is a lot more changes in the code and it will all be included in the next release that will be available later this summer.
Snap
VSCP will use the snap package system. Easy install. Easy use. Debian packages is still in the pipeline to.
Help
I will not ask directly for help here any more. It’s been a useless question to ask all times I tried (many now… 😉 ). That is OK. If you been hanging around the project you know you are welcome to contribute. The ever growing todo list is here.
That’s all for now. Midsummer here tomorrow. A day without any VSCP related work all together.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok