Recently, Yahoo change its API and forcing everyone to use OAuth 1.0 in order to access its data. You may experience empty weather info to Jubito's front-end, as well null responses from relational functions, such %todayconditions%, etc.
I decide to implement the new functionality with openweathermap.org API as the weather data source, which I found it more simple and clear.
3) Paste the URL you get including your APPID as a parameter, i.e.:
http://api.openweathermap.org/data/2.5/forecast/city?id=524901&units=metric&APPID={APIKEY}
You're all set. Now you can use some of the old functions, plus, the new ones for humidity and pressure. Find all the function set in GitHub wiki.
JubitOS-Z is a free Operating System (OS) for the Internet of Things
(IoT). A single image that convert your Banana Pi or BPi-R1 to a
inexpensive home automation hub.
The combined power of RaZberry and
Jubito brings together the most cutting edge technologies
like Z-Wave and Arduino. Regardless of whether you are a beginner, an experienced maker or a professional this
software will let you transform your house into a self-regulating
mechanism at an extremely low budget. No additional hub is required.
Furthermore you can install Kodi, ownCloud, and much more for enhanced
home center experience. Unlike any other proprietary product, it is
designed with open technologies. Now, privacy is in your hands. No registration, no dependency on cloud-based services.
Lately Jubito grows its family by contributions of individuals and vendors and I thank them in public each time I make a reference. More details in social networks e.g.: facebook.
Every piece of hardware I received has an interesting aspect that opens a new challenge to the Jubito ecosystem. For example, Z-Wave integration. An interesting technology, but still, a little bit expensive.
While I'm studying the Z-Way JSON API that allows to execute commands on server side using HTTP GET/POST requests, I'd like to share some early developments for those who want to learn the basics and for the adventurous. In this post I will deal with the RaZberry module by Z-Wave.me on a Banana Pro.
Since I currently owned only one device (Fibaro wall plug) I will focus on SwitchBinary Command Class (0x25/37). The Switch Binary Command Class is used to control all actuators with simple binary (on/off) switching functions, primarily electrical switches.
Those who have experience with the module will probably have a complete understanding of what I'm talking about.
But let's take a look at some methods. The command to execute is taken from the URL. All functions are executed in form: http://YOURIP:8083/<URL>
http://localhost:8083/ZWaveAPI/Run/devices[n].instances[0].SwitchBinary.Set(value) - Binary values accept 0-99 for switching off and 255 for switch on.
http://localhost:8083/ZWaveAPI/Run/devices[n].instances[0].SwitchBinary.data.level.value - Get the state of the device (true->on, false->off).
http://localhost:8083/ZWaveAPI/Run/devices[n].instances[0].Meter.data[s].val.value - Measures the amount of electrical energy in kWh that was consumed.
http://localhost:8083/ZWaveAPI/Run/devices[n].data.givenName.value='<A new name>' - Rename a device [2].
[1] You can include devices by pressing the 'Inclusion' button. This turns the controller into an inclusion mode that allows including a device. A led on the controller indicates this status. The inclusion of a device is typically confirmed with a triple press of a button of this particular device. However, please refer to the manual of this particular device for details how to include them into a Z-Wave network. The inclusion mode will time out after about 20 seconds or is aborted by pressing the 'Inclusion' button again.
The same applies for the 'Exclusion'.
[2] Rename a device:
Use <lock></lock> tags when you want to bypass parser and pass a URI with blank spaces as one argument.
To create an HTTP GET method as an Instruction Set for alternative use, you can move to Instructions->Add New Launcher and put your getter there. This will allow you to invoke a Z-Wave function into another Instruction Set. You can search in this blog for common actions, but I will come back later with analytical article (*).
You can review the whole object in real time to reveal all the available functions but I won't deepen on the data model -yet [ http://localhost:8083/ZWaveAPI/Data ]:
To have a human readable tree view, copy and paste the JSON object to an editor, such www.jsoneditoronline.org.
List of available devices [ http://localhost:8083/ZWaveAPI/Run/devices ]:
Let's stand here and see some examples on Jubito's side.
Jubito has a native API for HTTP GET method i.e.: judo http get <Request-URI>.
Try any of the above operations from the terminal. Examples:
judo http get http://localhost:8083/ZWaveAPI/Run/devices[n].data.givenName.value - Gets device name.
judo http get http://localhost:8083/ZWaveAPI/Run/devices[n].instances[0].commandClass[37].Set(255) - This will switch on the plug. It is equivalent to http://localhost:8083/ZWaveAPI/Run/devices[n].instances[0].SwitchBinary.Set(255) or .Set(0) to switch off.
That was a quick introduction to the Z-Way API. Before you get confused, Jubito comes with a simple interface that implements the basics like, inclusion, exclusion and list of available devices with their actions (on/off), including some additional information.
While is still beta, I won't add a link on the menu button yet, but you can navigate to z-index.html:
http://<host>:<port>/www/z-index.html
Please make sure you have the latest version [0.2.8.299]:
(*) Let's consider this post as the first part of a Z-Wave session. In future articles I will present ways, on how to use a specific function, on a custom Instruction Set, and how these can interact and expand functionality and logic by other mechanisms, including evaluations and schedules.
The other day I was returning home with both my hands occupied. While I was standing at the door I realized that I spent some time before I passed the card to the reader, unlocked and got inside. It was frustrating and clear that the RFID access control wasn't an efficient way for that task and had to be replaced with a smarter solution.
I started researching the internet for a long range RFID system that would allow me to check-in till I unlocked the door and therefore "sense" my presence and perform predefined actions like, change my status to present, turn on assistive light, bypass security camera, enable some schedules, etc. Unfortunately I realized that such systems are a little bit expensive for my taste.
Then I started to imagine a different radio approach. In the past I was using methods like geo location or bluetooth discovery but that also had drawbacks, i.e. GPS and data should be enabled, Jubito app as well, range limitations and so on. The obvious way was to use the WiFi network. The acknowledgement would be made with a continuous scan of my cellphone's IP address combined with the evaluation of my status. The ping method I had suppressed and undocumented took its place at last.
So let us continue and explore how it is done:
Step 1: Create a pinger. Go to Control Panel->Add New Launcher and type:
judo ping [host], in my case judo ping 192.168.1.95
Note: (Fixed) If ping always returns one state, it's because, in order to to send ICMP packets from linux you need root privileges. So if you determine that kind of behavior, try run jubito-server as root.
You can do an optional debugging from the terminal.
Step 2: Evaluation of ping result and user status. Control Panel->Add New Evaluator and type:
Step 3: Create a schedule that calls the evaluation every two and a half seconds (2500ms). Use with caution and experiment to find what it suits you. If you experience any problems with that time span, try to increase it.
Once again Control Panel->Scheduler->Add New.
That was it. Disable/Enable your WiFi to test.
So far it's the most convenient way of all I've tried before. Sometimes the simplest and most effective approach is what is required.
Update: While I spent some time with the ping check-in/check-out methodology, I realize that it's not a trustworthy solution to ping phones, due to its limitations, like, battery saving, etc, unless you set WiFi sleep policy to "Never". On the other hand, devices like routers or computers, which their always connected, behaves well.
Bottom line, use cases may vary. You can perform individual tasks based on specific IP's. For example, check if a router responds to ping, else send an email alert and turn off and on its power to reset.
In order to achieve a fully dynamic front end, I started working on a widget factory. The combination of two different Instruction Sets will give us the ability to view additional real time info within a dashboard item in a bubble form.
I will proceed by doing a simple example using framework functions (%greader% or %gmailreader% and %gcount% or %gmailcount%). The first will return the headers of the message(s) and the other one will be the counter.
Go to Control Panel->Add New Launcher and follow the screenshots...
Now we'll create a new dashboard item that includes both of the above.
Navigate to Control Panel->Add New Instruction Set
Scroll down to Add to Dashboard and fill Category, Header, Thumbnail (optional) and Reference field.
Save it and return to the Dashboard. You should be able to see something like that...
When you click Gmail Check you will get the response of gmail launcher.
For older Instruction Sets, edit the AppConfig.xml and add a reference attribute (ref) that points to the Instruction Set ID you want to call. For this example, gmailwidget.
You may notice temperature and humidity values as well in the screenshots. It has the same logic but first you should take a look at arduino tutorials.