Categories
VSCP

#VSCP variables #IoT #m2m

Screenshot from 2016-01-25 21:19:35

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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.