EricssonResearch / calvin-base

Calvin is an application environment that lets things talk to things, among other things.
Apache License 2.0
282 stars 91 forks source link

Sensor Virtual Weather Not Found #113

Closed Tatiana-runco closed 5 years ago

Tatiana-runco commented 5 years ago

Hello!

I did several tests to see the time of my city in my time of execution. This does not give me an error but it does not generate output either. let's see: my city is San Juan Argentina my atributes.json file: {     "indexed_public": {         "address": {             "city": "San Juan",             "country": "AR"         }     } }

API key:

Endpoint:

My calvin.conf file:

[removed by olaan]

Then on my console I made: cd /home/ tatu/calvin-base-develop/calvin/examples/weather/  csruntime --host localhost localweather.calvin

or execute:

csruntime --host localhost localweather.calvin --attr-file attributes.json

But none of them gives me a result Result.txt

olaan commented 5 years ago

Hello!

Two things:

  1. Do not disclose your API-key in an open forum like this. (I've edited your message to remove it.)
  2. In the calvin.conf file, the API-key should be entered as "XXXX" and not "". Remove < and > and it should work.

Cheers

Tatiana-runco commented 5 years ago

I tried that too and it did not work for me. I get exactly the same result.

olaan commented 5 years ago

You are absolutely correct. There was a typo in the description (and the attributes.json file) which has now been corrected.

Instead of city it should read locality as shown below.

{
    "indexed_public": {
        "address": {
            "locality": "San Juan",
            "country": "AR"
        }
    }
}

Replace your attributes.json file with this one and try again. It should work. I hope.

Cheers.

Tatiana-runco commented 5 years ago

It worked perfectly, Thank you very much! Would you be so kind as to tell me which configuration should I write in the calvin.conf of calvin/examples/ui_in_gui to be able to use it in the GUI?

olaan commented 5 years ago

Unfortunately there is not yet a way to include this in the calvin.conf file.

In order to get the weather functionality in the gui, you need to add the following to the calvin.conf (right after the "capabilities": { line):

            "weather.local": {
                "module": "web.openweathermap.OpenWeatherMap",
                "attributes": {"appid": "your app id"}
            },

then copy the attributes.json file to the same directory and add the --attr-file attributes.json to the command line when starting the runtime. You should then be able to use the web.LocalWeather() actor. If you also add

            "weather": {
                "module": "web.openweathermap.OpenWeatherMap",
                "attributes": {"appid": "your app id"}
            },

you can use the web.TriggeredWeather() to get the forecast from anywhere.

Cheers

Tatiana-runco commented 5 years ago

Thanks worked perfectly!