Source: PSF-A85 WiFi Wireless Module
Author: admin
#VSCP variables #IoT #m2m
Variables is a big thing in the VSCP daemon. You may wonder why? What the fuck, can a variable be sexy or even be an interesting feature. I would say yes. But don’t trust me. Read on.
In VSCP land two sorts of variables are known. Persistent and non persistent. This is all about sessions. A non persistent variable is fast but is sent to never never land after a power loss or a VSCP daemon restart. That is, they get lost when a session ends. Still useful for many things. But never around for to long. A bit like money if you think of it. At least my money. Fun and useful when they are around.
The other type, the persistent one, lives also after a power drop and a VSCP server restart. They live and survive also over sessions. That is, works just as they where a database items. Tell you a secret? They are. They are just exposed to the word as a “variable”.
All VSCP variables have a type. The type tells what sort of value a variable holds. There are plenty of types. First there are types like a string, integer, long, double, boolean. A string just stores some sort of text, just as an integer type stores a number and so on. You have date, time and that kind of thing also of course.
Then there is VSCP relate types such as variables holding events or GUID’s etc. Not to unexpected to find in a VSCP related system. The rest of the types may be more surprising. JavaScript. HTML pages. LUA scripts. User interfaces… You have a full list here.
Well a short explanation may be in place. The scripts can be executed by the daemon when an event is received. Yes you can program your advanced scenes with them. The HTML pages and user interface parts are holders for user interface elements for your particular setup.
The great things with variables is that they are remotely available. To write a variable from an Arudino or some other board just log into the TCP/IP interface and issue
variable write current-temperature 13.31
to set an integer variable value to the value “13.31”. Or to read its value
variable readvalue current-temperature
which will return the variables current value. You can do this from anywhere. From small things or from php scripts and from large things.
But…
it’s not just through the tcp/ip interface you can handle variables. You can reach them over all interfaces. The REST interface. The websocket interface. The MQTT interface. The CoAP interface. They are accessible from all parts of the system.
And more…
you have access to them in your LUA scripts, Javascripts, HTML pages and in the local decision matrix of the VSCP daemon.
So in their simplest form. Variables is just a storage position. You store something in them. But once stored they can be displayed, calculated with, being the source for complex decisions or automatically be sent to other parts of a system for that part to carry out great things when they arrive.
And security…
which is state of the art of course.
Yes I definitely think that VSCP variables is a sexy thing.
Changes #VSCP #IoT #m2m
I should work with hardware modules in Grodans Paradis AB because it is a much greater chance to get some money back from the work I do there. And sadly we all need money to survive.
But…
I work with the software at the moment. And I will continue to do so for some time. Neglecting my own hardware development then of course. Well I actually decided some month’s ago to do hardware some days each week and software the other. But (again) I need the changes and additions I am working on right now to go on. So it’s has been and will be still for some time only software work.
So what is it?
Many have heard me talking about databases in VSCP. At leat if you been around at all. Not so hot and sexy you may say, but by adding them there is much easier to do a nice remote administrative interface. Also the discovery process becomes much simpler.
And yes I do plenty of Javascript now. UX work to. I am not the man to do this kind of work because I am really bad on it, but if no one else does it…
So expect an administrative interface where settings for the local/remote daemon can be changed in a secure way, where devices can be discovered, where data/measurements can be visualized, where drivers can be installed/uninstalled and much more.
And then there is variables. Variables will be the common interface to set all values. So users, driver, DM-rows, measurement values, tables, discoveries and all the rest of the functionality that is available in the VSCP daemon will be exposed as variables. Accessible through the tcp/ip interface, the REST-interface, the web socket interface , the MQTT inteface, the CoAP interface and from LUA, Javascript and with the helperlib from all local or remote applications.
Oh well, somewhere further ahead at least.
Thanks #VSCP #IoT #M2M
Again I would like to thank you guys again for support for the project. You all know who you are. VSCP have no angel investors or big institution founders and it can be hard to stand independent during long coding runs as we are in now. Still with the support from the community we will, in the end, deliver the IoT solution that unite them all. I promise you that.
Motivation #IoT #VSCP #m2m
Working with a new administrative interface for the VSCP daemon. One must think that by taking one step at the time, one will eventually reach the top, or at least, by continue digging, even on your own, it will eventually, at last, be a big hole.
#VSCP multicast #IoT #m2m
224.0.23.158
Yes VSCP has a multicast channel assigned. The above is the assigned IPv4 address for it.
Announcements
All higher level IP equipment should send announcements on this multicast address. The port used is 9598, the registered VSCP port.
This means that if you want to know what units are on a multicast segment you just listen on this channel.
Announcements can be of three different types
-
VSCP daemon announcements. Announce the availability of a VSCP daemon (or other server with exported interfaces) and tell its capabilities.
-
High end device announce. Announce the availability of the device and its capability. All Level II nodes should have this functionality. At the bottom line they just look to the system as a VSCP daemon with fewer capabilities.
-
Heart beats: Heart beats come in the form of heartbeats from VSCP daemons and from high-end nodes. Both send them out each minute. Also heartbeats are available form devices connected to a daemon or through a high-end node.
- CLASS2.Protocol Type=20 is used for announcements.
- CLASS1.INFORMATION Type=9 is used for heartbeats
User multicast channels
Users can set up proprietary multicast channels using some other port than the VSCP assigned 9598. This makes it easy to create groups of VSCP nodes that can communicate with each other in much the same way as on a CAN bus.
Two factors that must be taken into account is the unsecured nature of this type of communication. Delivery is never guaranteed. But most of the time this is not a problem in VSCP if one design the event exchange around it. That is that a node that digest an event also send some sort of confirm/information event when doing so. The other problem is that it is easy to go in a mess about with the traffic for a user that is not allowed to do that. Something that is easily solved with cryptographic routines. Some VSCP standardization (and samples) will come here in the future.
You can read more here.
The VSCP GUID #IoT #m2m #VSCP
Today I am writing about the globally unique identification code (GUID). Can it be more boring than that? Well maybe not, but it is needed in VSCP, and it is important for any VSCP system to work.
Lets get started.
First the VSCP GUID is 16-bytes and looks something like this
FF:60:83:12:111:49:A0:1C:00:97:97:C8:CC:02:01:42
Sixteen hex bytes forming a globally unique id. MSB is to the left. An empty or unassigned GUID is represented by all nills
00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
you can see this in many configuration files where the GUID is expected to come from some other place. This unassigned GUID should never be used on a working system.
By writing to guid@vscp.org and request a GUID series you can get a series of GUID’s for your own project. Doing so you will get something like
27:00:00:00:00:00:00:00:00:00:00:00:XX:XX:XX:XX
(this GUID btw belongs to Grodans Paradis AB).
The XX:XX:XX:XX part is what we have for our own devices. So with it we can start out and set
00:aa:bb:cc
for product series 00 (aa:bb:cc is increased for every built unit) and products series 01 get
01:aa:bb:cc
etc. Or we just have a number that is increase for every product made. Or we request a new series of GUID’s for each product series. The important thing is that no other device on earth (or in the universe for that matter) should have the same GUID.
Requesting GUID’s is btw free of charge. After all VSCP IS free, will be free and is proud to be free and open forever. We may starve to death in the process of keeping it that way though. I can promise GUID’s (and VSCP) will still be free.
You can find current assigned GUID’s here.
But wait now, with VSCP being the protocol of the world, the IoT framework that unite them all, every IoT makers first choice etc, should it not be a lot more people requesting GUID’s. (Note: Joking here (Note: At least try to. ) )
Well one of the reasons is that you actually do not need to request a GUID, you probably have one already, or more precise you can form one.
For example if you have a machine that have an Ethernet MAC address you are in the free. Using it you also have a series of GUID’s you can use. The reason is that some GUID series has been set aside for other id series. You can find them all here.
FF:FF:FF:FF:FF:FF:FF:FE:YY:YY:YY:YY:YY:YY:XX:XX
The series
FF:FF:FF:FF:FF:FF:FF:FE:00:00:00:00:00:00:00:00
is set aside for Ethernet MAC range. The
YY:YY:YY:YY:YY:YY
is the MAC address (MSB left, first), and
XX:XX
is the part you can assign to your own devices.
There is also a range set aside for IPv4 addresses
FF:FF:FF:FF:FF:FF:FF:FD:YY:YY:YY:YY:XX:XX:XX:XX
where again
YY:YY:YY:YY
is the IPv4 address and
XX:XX:XX:XX
is the bytes you can use for your own devices.
If you look at the list there are many other possibilities to form GUID’s from other unique ID’s.
Where is it stored?
Every device have a GUID and it is stored in the standard register space from where you can read it. You find it at address 208/0xD0-223/0xDF for a Level I device and on address 0xffffffd0 – 0xffffffdf on a Level II device.
Proxy GUID’s
When a device send you an event in higher level software the GUID is usually part of the message. For instance you can get a temperature sent to you from a device with GUID
FF:FF:FF:FF:FF:FF:FF:FD:C0:A8:01:33:01:02:00:04
and then when you read the GUID from the actual device you get
32:00:00:00:00:00:00:00:00:00:00:00:20:13:02:88
which appears to be wrong. But it isn’t actually wrong, the temperature event from the device have just probably passed another interface which acted like a proxy for the actual device.
This is not as hard to understand as it sound. GUID’s are 16 bytes and therefore far to big to use in many low-end transmission media. On the CAN bus for example VSCP uses only one byte for its id. This byte is called a nickname id as it is a nickname, a simpler version, of the full GUID. Other systems may have 16-bit nicknames and even other formats.
The thing with VSCP nicknames is that when they pass an interface they wil take the interfaces GUID and place the nickname in the LSB. So the GUID
FF:FF:FF:FF:FF:FF:FF:FD:C0:A8:01:33:01:02:00:04
comes from an interface
FF:FF:FF:FF:FF:FF:FF:FD:C0:A8:01:33:01:02:00:00
on a machine with IP address 192.168.1.51 (C0:A8:01:33:01) . On that interface a node has reported a temperature and that node use the nickname 04 or 0004 on the subsystem connected to the interface. I can now communicate with that device on this GUID as it was the GUID of the device itself and actually it is in a way.
GUID’s are used for everything in VSCP. Locations also have GUID’s. Servers have them. The principle is simple. Very simple indeed.
That was all for this week. Enjoy your weekend. I will work with a new admin interface for the VSCP daemon this weekend.
Cheers
/Ake