• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


OpenWeatherMap
#1
Hey,

after adding the update button to the protocol, the questions pops up, how to use it. Currently i've played around with this config:

Code:
"Wetter": {
                        "name": "Wetter",
                        "protocol": [ "openweathermap" ],
                        "id": [{
                            "location": "muenster",
                            "country": "de"    
                        }],
                        "humidity": 1,
                        "temperature": 1,
                        "poll-interval": 600,
                        "sunrise": 720,
                        "sunset": 2003,
                        "update": 1,
                        "sun": "set",
                        "gui-show-update": 1,
                        "gui-show-sunriseset": 1,
                        "gui-show-humidity": 1,
                        "gui-show-temperature": 1
                },

How exactly does the update button work?
As I understand this, if "update" is set to 1, you can click the update button and refresh the data manually.
But the button is grey and I cannot click on it (or it does not give any feedback?

Can you clarify this, curlymo?
 
Reply
#2
Yes, you can but not within the poll-interval. So after 10 min. the update button works and then after 10 min. it can work again. However, you set the poll-interval already to 10m so the update button won't ever work.

Also, gray is just the style of the pilight gui elements Smile
 
Reply
#3
Ah OK. Thanks for clearing. Makes sense to me Smile
 
Reply
#4
Hey,

is there any possibility to get the actual status of the weather?

The API of Openweathermap returns the following:
Code:
"weather":[{"id":521,"main":"Rain","description":"proximity shower rain","icon":"09d"}]

I want the "main":"Rain" part of it. Is this already included in the protocol? If not, how can I do that?

Another thing I want is a 7-day forecast. But I think, this isn't included yet.

EDIT: If I edit the openweathermap protocol, do I have to compile the whole pilight program again or can I only compile the protocol?
 
Reply
#5
Compile:
Just run the ./setup.sh script, it checks the dependencies.
 
Reply
#6
I tried to add the "weather/main" data to the openweathermap protocol.

Here are the changes I made:
http://www.diffnow.com/?report=ctfd6

When I try to start the pilight server I get the following error:
Quote:[....] Starting : pilight/usr/local/sbin/pilight-daemon: error while loading shared libraries: libpilight.so: cannot open shared object file: No such file or directory
failed!

Compile-Log:
Code:
-- Looking for libz
-- Looking for libz - found (/usr/lib/arm-linux-gnueabihf/libz.so)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/pilight
Scanning dependencies of target pilight
[  1%] Building C object CMakeFiles/pilight.dir/libs/protocols/openweathermap.c.o
[ 90%] Built target pilight
Linking C shared library libpilight.so
[ 90%] Built target pilight_shared
Linking C executable pilight-control
[ 91%] Built target pilight-control
Linking C executable pilight-daemon
[ 92%] Built target pilight-daemon
Linking C executable pilight-debug
[ 93%] Built target pilight-debug
Linking C executable pilight-flash
[ 94%] Built target pilight-flash
Linking C executable pilight-learn
[ 95%] Built target pilight-learn
Linking C executable pilight-raw
[ 96%] Built target pilight-raw
Linking C executable pilight-receive
[ 97%] Built target pilight-receive
Linking C executable pilight-send
[ 98%] Built target pilight-send
Linking C executable pilight-uuid
[100%] Built target pilight-uuid
Linking C static library libpilight.a
[100%] Built target pilight_static
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/pilight/libpilight.so.5.0
-- Installing: /usr/local/lib/pilight/libpilight.a
-- Installing: /usr/local/share/pilight
-- Installing: /usr/local/share/pilight/default
-- Up-to-date: /usr/local/share/pilight/default/screen_active.png
-- Up-to-date: /usr/local/share/pilight/default/index.html
-- Up-to-date: /usr/local/share/pilight/default/play.png
-- Up-to-date: /usr/local/share/pilight/default/moment.min.js
-- Up-to-date: /usr/local/share/pilight/default/jquery.mobile-1.4.2.min.js
-- Up-to-date: /usr/local/share/pilight/default/apple-touch-icon-iphone-retina-display.png
-- Up-to-date: /usr/local/share/pilight/default/temp.png
-- Up-to-date: /usr/local/share/pilight/default/battery_red.png
-- Up-to-date: /usr/local/share/pilight/default/battery_green.png
-- Up-to-date: /usr/local/share/pilight/default/favicon.ico
-- Up-to-date: /usr/local/share/pilight/default/song.png
-- Up-to-date: /usr/local/share/pilight/default/pilight.js
-- Up-to-date: /usr/local/share/pilight/default/humi.png
-- Up-to-date: /usr/local/share/pilight/default/logo.png
-- Up-to-date: /usr/local/share/pilight/default/apple-touch-icon-iphone.png
-- Up-to-date: /usr/local/share/pilight/default/sunset_blue.png
-- Up-to-date: /usr/local/share/pilight/default/ajax-loader.gif
-- Up-to-date: /usr/local/share/pilight/default/episode.png
-- Up-to-date: /usr/local/share/pilight/default/apple-touch-icon-iphone-retina-display-hr.png
-- Installing: /usr/local/share/pilight/default/images
-- Up-to-date: /usr/local/share/pilight/default/images/ajax-loader.gif
-- Up-to-date: /usr/local/share/pilight/default/images/icons-36-white.png
-- Up-to-date: /usr/local/share/pilight/default/images/icons-18-white.png
-- Up-to-date: /usr/local/share/pilight/default/jquery-2.0.2.min.js
-- Up-to-date: /usr/local/share/pilight/default/apple-touch-icon-ipad.png
-- Up-to-date: /usr/local/share/pilight/default/home.png
-- Up-to-date: /usr/local/share/pilight/default/stop.png
-- Up-to-date: /usr/local/share/pilight/default/sunrise_yellow.png
-- Up-to-date: /usr/local/share/pilight/default/pilight.jquery.theme.css
-- Up-to-date: /usr/local/share/pilight/default/screen_inactive.png
-- Up-to-date: /usr/local/share/pilight/default/sunset_gray.png
-- Up-to-date: /usr/local/share/pilight/default/version.txt
-- Up-to-date: /usr/local/share/pilight/default/jquery.mobile-1.4.2.min.css
-- Up-to-date: /usr/local/share/pilight/default/movie.png
-- Up-to-date: /usr/local/share/pilight/default/shutdown.png
-- Up-to-date: /usr/local/share/pilight/default/pilight.css
-- Up-to-date: /usr/local/share/pilight/default/update_active.png
-- Up-to-date: /usr/local/share/pilight/default/update_inactive.png
-- Up-to-date: /usr/local/share/pilight/default/sunrise_gray.png
-- Up-to-date: /usr/local/share/pilight/default/pause.png
-- Up-to-date: /etc/init.d/pilight
-- Installing: /etc/pilight/settings.json
-- Up-to-date: /etc/pilight/tzdata.json
-- Installing: /etc/pilight/hardware.json
-- Installing: /usr/local/sbin/pilight-daemon
-- Installing: /usr/local/sbin/pilight-raw
-- Installing: /usr/local/bin/pilight-send
-- Installing: /usr/local/bin/pilight-control
-- Installing: /usr/local/sbin/pilight-learn
-- Installing: /usr/local/bin/pilight-receive
-- Installing: /usr/local/sbin/pilight-debug
-- Installing: /usr/local/sbin/pilight-flash
-- Installing: /usr/local/bin/pilight-uuid
update-rc.d: using dependency based boot sequencing
 
Reply
#7
Please edit your posting and use code tags (check help if you do not know what i mean), in order to keep the length of your posting shorter.

Just run ./setup.sh again
 
Reply
#8
Thanks for your answer.

I've edited the post.

After running setup.sh again, the service starts.

But I found an error in my code.

The openweathermap API returns this JSON Object:
Code:
"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}]

The ohters (like "sys") are looking like this:
Code:
"sys":{"type":3,"id":46580,"message":0.1962,"country":"DE","sunrise":1408508406,"sunset":1408559143}

The difference between both is, that "weather" has also [] brackets. How do I handle this?

Code:
jweather = json_find_member(jdata, "weather")
json_find_string(jweather, "main", &weathermain
doesn't work


EDIT:

Got it:
Code:
json_first_child
does the job
 
Reply
#9
When I include the openweathermap protocol in my Config. I become an error.

My pilight Version is:
Code:
root@raspberrypi:/etc/pilight# pilight-daemon -V
pilight-daemon version 5.0, commit v5.0-157-g7957874

My config for the openweathermap is:
Code:
"devices": {
        "temp": {
            "protocol": [ "openweathermap" ],
            "id": [{
                "location": "Ginsheim-Gustavsburg",
                "country": "de"
            }],
            "humidity": 7600,
            "temperature": 700,
            "sunrise": 1,
            "sunset": 700,
            "sun": "set"
                },
.........
"gui": {
    "temp": {
          "name": "Aussentemperatur",
          "group": [ "Wohnzimmer" ],
          "media": [ "all" ]
      }

And the error is:
Code:
root@raspberrypi:/usr/local/share/pilight/default# service pilight start
[....] Starting : pilight[Jan 04 08:24:12:410388] pilight-daemon: ERROR: config device setting #2 "id" of "temp", invalid
failed!
 
Reply
#10
And fixed.
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)