Page 1 of 1

LoraWAN - The Things Network

Posted: 30 Oct 2015 14:37
by pz1
Just to share with you.

A couple of days ago an interesting for the people and by the people project opened on Kickstarter: TheThingsNetwork.

It uses the long range LoRaWan technology. Potentially this is an interesting complementary technology to Zway, but also other home automation solutions. It can help you connect to sensors too far away for Z-Wave. It typically deploys low power remote battery driven sensors that can last for a couple of years.
This citizen maintained network is completely free and open source. Not only the software, but also the hatdware. No controlling companies. For example citizens and small comapnies set up a network covering Amsterdam in a matter of 6 weeks. The major focus of the Kickstarter project is to make a very low cost (~200 EURO) gateway. These gateways have a range in the order of 10km.

Do not confuse this network with internet. Some people do call in Internet 3. I think that is wrong. It is a slow but reliable and safe data network. It does interface using for example with http, so perfectly usable with ZWay.
For more detail see for yourself at the links I provided.

Additional usefull links

Re: LoraWAN - The Things Network

Posted: 06 Nov 2015 16:35
by albertov
It think I got the concept of TTH and I think that the project is really really interesting.
Unfortunately, I don't have the knowledge necessary to try it...

Re: LoraWAN - The Things Network

Posted: 06 Nov 2015 16:55
by pz1
albertov wrote:I don't have the knowledge necessary to try it...
Neither have I yet.

IMHO the real importance of TTN is not so much in the technology, but in the fact that in principle it is a completely free and open network setup by users for the users. Still, as a gateway owner, you have the means to make your node and your sensors as open as you want.

I have ordered the gateway hardware, but it will take some time before it arrives here. For brave people there are some DIY projects like this

Re: LoraWAN - The Things Network

Posted: 11 Nov 2015 14:49
by pz1
I am in the proces of making a TTNLoraWAN module. I have successfully managed to get temperature readings with OpenRemote. On the ZWay side I do have problems (due to may lack of knowledge) to parse the JSON data I receive from the Demo handler service. The JSON looks like this:

Code: Select all

[
    {
        "node_eui": "02013101",
        "data_plain": "{\"node\":\"THINGSIO_1\",\"temperature\":18.32}",
        "data_json": {
            "temperature": 18.32,
            "node": "THINGSIO_1"
        },
        "data": "eyJub2RlIjoiVEhJTkdTSU9fMSIsInRlbXBlcmF0dXJlIjoxOC4zMn0=",
        "time": "2015-11-11T11:31:05.555634146Z",
        "data_raw": "gAExAQIAAQAGYm6YGoug2hMN1MuDh/Sz8KF0sNeKLDNfA9vgRhtFdn5hfGuGw/dAd08ZGu2n",
        "gateway_eui": "1DEE15E85FA7DCEF"
    },
<multiple similar records
]
With OpenRemote (JAVA application) I can retrieve the temperature value of the first record with JSONPath expression:

Code: Select all

$..data_json.temperature[0]
I have tried several variations on this but all end in JS errors or no returned values. Below a snippet of the relevant code that is derived from the OpenWeather module:

Code: Select all

erroneous code removed

Re: LoraWAN - The Things Network

Posted: 12 Nov 2015 18:30
by pofs
Probably something like

Code: Select all

http.request({
    url: "http://thethingsnetwork.org/api/v0/nodes/02013101/?format=json",
    method: "GET",
    async: true,
    success: function(res) {
        var data = res.data;
        if (data instanceof Array) {
            var first_entry = data[0];
            debugPrint(first_entry.time, first_entry.node_eui, first_entry.data_json.temperature);
        }   
        else
            throw "Invalid data format";      
    }
})

Re: LoraWAN - The Things Network

Posted: 13 Nov 2015 16:37
by pz1
@pofs
Thanks it works

Re: LoraWAN - The Things Network

Posted: 27 Nov 2015 14:47
by pz1
pofs wrote:

Code: Select all

// fragment of your code
        var data = res.data;
        if (data instanceof Array) {
            var first_entry = data[0];
           debugPrint(first_entry.data_json.temperature);
I tried to get the path to the data(data_json.temperature) from the module's configuration screen.
Therefor I changed my module's code from:

Code: Select all

 self.vDev.set("metrics:level", first_entry.data_json.temperature);
into

Code: Select all

 self.vDev.set("metrics:level", "first_entry." + self.config.sensor);
This is apparantly wrong. It does create the correct string (first_entry.data_json.temperature),
but it is treated as just a string value and not as a "pointer" into the array.
How do I get that right?

Re: LoraWAN - The Things Network

Posted: 29 Nov 2015 01:54
by PoltoS
This is solvable using eval(), but eval is evil ;)

first_entry.data_json[self.config.sensor] can be used is self.config.sensor contains "temperature"

Re: LoraWAN - The Things Network

Posted: 29 Nov 2015 11:46
by pz1
You made my day! Thanks