Author Topic: Developing a Weather Plugin, videos  (Read 87252 times)

SBCC

  • Guru
  • ****
  • Posts: 164
    • View Profile
Re: Developing a Weather Plugin, videos
« Reply #90 on: February 19, 2015, 01:12:19 pm »
Hi

Below is a link to the current Weather project folder. This depends on libcurl and libjsoncpp. I still want to add some notes and radar is still not implemented but otherwise works fine for NOAA only. I'm still not sure how the pluto_mutexes work and if they are working but it's been running for a day and no crashes yet. In script in the device web admin page Configuration Data I've added a timer to affect the data update time as "timer:'min'". So "timer:10" would get the web data every 10 minutes. This defaults to 5 minutes. I've added defaults for everything. Feedback is appreciated.

https://www.dropbox.com/sh/nd2jtf4eg2jl8pw/AAB9-De03ogqI3AqRbw4VNIza?dl=0

Thanks

Jim

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: Developing a Weather Plugin, videos
« Reply #91 on: February 20, 2015, 03:14:45 pm »
Hello everybody.

I am doing a series of videos detailing the creation of a Weather Plugin, as an example of how to use Plugins to add whole house functionality to Orbiter.

The first video can be viewed here:

-Thom

Nice Video Thom...loving the spaced out soundtrack :-)

Andy
Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk

SBCC

  • Guru
  • ****
  • Posts: 164
    • View Profile
Re: Developing a Weather Plugin, videos
« Reply #92 on: February 21, 2015, 12:13:43 am »
Open Weather Map allowed us to use their API for free without adding their name on the orbiter. They only requested that we mention them on the website and any wiki page for the weather screen. If this is OK and can be done I will go ahead and add that API as it works for global weather.

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3675
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Developing a Weather Plugin, videos
« Reply #93 on: February 21, 2015, 10:51:50 am »
Fine with me.

cfernandes

  • Guru
  • ****
  • Posts: 359
    • View Profile
    • my company web site
Re: Developing a Weather Plugin, videos
« Reply #94 on: February 24, 2015, 07:28:56 pm »
Hi Jim

i made some change  on code, now  is working  with NOAA  and  Word Weather online.
I'll leave running for a few days at home to see if everything is ok!


Carlos

cfernandes

  • Guru
  • ****
  • Posts: 359
    • View Profile
    • my company web site
Re: Developing a Weather Plugin, videos
« Reply #95 on: February 26, 2015, 11:57:27 am »
Jim,

my changes   is:  change NOAA and WWO (word Weather Online) to read  configuration parameter on  web admin.

for NOAA  Configuration is   API:NOAA:language:units:lat:lon 
                            example API:NOAA:english:0:28.53833355:-81.37923649
for WWO  Configuration is   API:WWO:language:apikey:units:city 
                             example API:WWO:pt:0b6d39679dabe54e9749209aa2e54:C:belo_horizonte

my code https://www.dropbox.com/s/3qmrdmo84cfv9gg/weather.tar?dl=0
« Last Edit: March 04, 2015, 02:36:40 pm by cfernandes »

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Developing a Weather Plugin, videos
« Reply #96 on: March 01, 2015, 04:43:30 pm »
Hey guys, I've been distracted.  How are things going?  Is there anything I can do to help right now?

J(ason).

cfernandes

  • Guru
  • ****
  • Posts: 359
    • View Profile
    • my company web site
Re: Developing a Weather Plugin, videos
« Reply #97 on: March 04, 2015, 02:37:57 pm »
Hi ,

i finished the code  and resolve some issues 100% use off cpu .

Feedback is appreciated.

https://www.dropbox.com/s/3qmrdmo84cfv9gg/weather.tar?dl=0
« Last Edit: March 06, 2015, 01:07:47 pm by cfernandes »

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Developing a Weather Plugin, videos
« Reply #98 on: March 09, 2015, 11:06:12 pm »
Awesome!  I'll check this out over the next couple of days!

J.

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Developing a Weather Plugin, videos
« Reply #99 on: March 09, 2015, 11:29:48 pm »
Code: [Select]
Weather.cpp: In member function 'virtual bool DCE::Weather::GetConfig()':
Weather.cpp:92:39: error: 'DATA_Get_Configuration' was not declared in this scope
make: *** [Weather.o] Error 1

Looks like I need to run dcegen to populate the base class with the data accessors.

J.

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Developing a Weather Plugin, videos
« Reply #100 on: March 09, 2015, 11:48:42 pm »
So after DCEGen run I now get a new error.  Looks like an issue with the mutex calls.

Code: [Select]
(1204)root@1404builder:/var/lmce-build/svn/trunk/src/Weather# make clean
for dir in ; do cd $dir; make clean; cd ..; done
rm -f Main.o Weather.o ../Gen_Devices/WeatherBase.o NOAA.o WWO.o Main.d Weather.d ../Gen_Devices/WeatherBase.d NOAA.d WWO.d Weather Weather.so >/dev/null
(1204)root@1404builder:/var/lmce-build/svn/trunk/src/Weather# make bin | tee buildlog.txt
Computing dependencies for WWO.cpp done
Computing dependencies for NOAA.cpp done
Computing dependencies for ../Gen_Devices/WeatherBase.cpp done
Computing dependencies for Weather.cpp done
Computing dependencies for Main.cpp done
g++ -c -I.. -I../DCE -I/usr/include/mysql -DKDE_LMCE -DDEBUG -DTHREAD_LOG -DLOG_ALL_QUERIES  -Wall -fPIC -ggdb3  Main.cpp -o Main.o
g++ -c -I.. -I../DCE -I/usr/include/mysql -DKDE_LMCE -DDEBUG -DTHREAD_LOG -DLOG_ALL_QUERIES  -Wall -fPIC -ggdb3  Weather.cpp -o Weather.o
Weather.cpp: In constructor 'DCE::Weather::Weather(int, std::string, bool, bool, DCE::Router*)':
Weather.cpp:45:83: error: no matching function for call to 'pluto_pthread_mutex_t::pluto_pthread_mutex_t()'
Weather.cpp:45:83: note: candidates are:
../PlutoUtils/MultiThreadIncludes.h:112:2: note: pluto_pthread_mutex_t::pluto_pthread_mutex_t(std::string, bool)
../PlutoUtils/MultiThreadIncludes.h:112:2: note:   candidate expects 2 arguments, 0 provided
../PlutoUtils/MultiThreadIncludes.h:101:7: note: pluto_pthread_mutex_t::pluto_pthread_mutex_t(const pluto_pthread_mutex_t&)
../PlutoUtils/MultiThreadIncludes.h:101:7: note:   candidate expects 1 argument, 0 provided
Weather.cpp:45:83: error: no matching function for call to 'pluto_pthread_mutex_t::pluto_pthread_mutex_t()'
Weather.cpp:45:83: note: candidates are:
../PlutoUtils/MultiThreadIncludes.h:112:2: note: pluto_pthread_mutex_t::pluto_pthread_mutex_t(std::string, bool)
../PlutoUtils/MultiThreadIncludes.h:112:2: note:   candidate expects 2 arguments, 0 provided
../PlutoUtils/MultiThreadIncludes.h:101:7: note: pluto_pthread_mutex_t::pluto_pthread_mutex_t(const pluto_pthread_mutex_t&)
../PlutoUtils/MultiThreadIncludes.h:101:7: note:   candidate expects 1 argument, 0 provided
Weather.cpp: In constructor 'DCE::Weather::Weather(DCE::Command_Impl*, DCE::DeviceData_Impl*, DCE::Event_Impl*, DCE::Router*)':
Weather.cpp:55:65: error: no matching function for call to 'pluto_pthread_mutex_t::pluto_pthread_mutex_t()'
Weather.cpp:55:65: note: candidates are:
../PlutoUtils/MultiThreadIncludes.h:112:2: note: pluto_pthread_mutex_t::pluto_pthread_mutex_t(std::string, bool)
../PlutoUtils/MultiThreadIncludes.h:112:2: note:   candidate expects 2 arguments, 0 provided
../PlutoUtils/MultiThreadIncludes.h:101:7: note: pluto_pthread_mutex_t::pluto_pthread_mutex_t(const pluto_pthread_mutex_t&)
../PlutoUtils/MultiThreadIncludes.h:101:7: note:   candidate expects 1 argument, 0 provided
Weather.cpp:55:65: error: no matching function for call to 'pluto_pthread_mutex_t::pluto_pthread_mutex_t()'
Weather.cpp:55:65: note: candidates are:
../PlutoUtils/MultiThreadIncludes.h:112:2: note: pluto_pthread_mutex_t::pluto_pthread_mutex_t(std::string, bool)
../PlutoUtils/MultiThreadIncludes.h:112:2: note:   candidate expects 2 arguments, 0 provided
../PlutoUtils/MultiThreadIncludes.h:101:7: note: pluto_pthread_mutex_t::pluto_pthread_mutex_t(const pluto_pthread_mutex_t&)
../PlutoUtils/MultiThreadIncludes.h:101:7: note:   candidate expects 1 argument, 0 provided
make: *** [Weather.o] Error 1

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Developing a Weather Plugin, videos
« Reply #101 on: March 10, 2015, 11:15:19 pm »
Code: [Select]
========== NEW LOG SECTION ==========
1       03/10/15 18:13:03       193 (spawning-device)   Starting... 2
1       03/10/15 18:13:03       193 (spawning-device)   Found /usr/pluto/bin/Weather
05      03/10/15 18:13:13.683           Weather: Config: NOAA <0xb6677700>
05      03/10/15 18:13:13.684           Weather: Use NOAA <0xb6677700>
05      03/10/15 18:13:13.684           Weather: Use NOAA language english <0xb6677700>
05      03/10/15 18:13:13.684           Weather: Use NOAA units 0 <0xb6677700>
05      03/10/15 18:13:13.684           Weather: Use NOAA Lat xx.xxx <0xb6677700>
05      03/10/15 18:13:13.684           Weather: Use NOAA Lon -xx.xxx <0xb6677700>
05      03/10/15 18:13:13.685           Weather: Starting Init Thread <0xb6677700>
05      03/10/15 18:13:13.686           Weather: Timer is set to: 3.000000 minutes <0xb6675b40>
05      03/10/15 18:13:13.690           Weather: Getting Weather Data using: NOAA <0xb54ffb40>
05      03/10/15 18:13:13.690           Weather: Inside use_NOAA <0xb54ffb40>
01      03/10/15 18:13:14.119           Get_NOAA: Failed to parse configuration <0xb54ffb40>

cfernandes this is the log output I am getting from Weather (lat/long removed).

J.

cfernandes

  • Guru
  • ****
  • Posts: 359
    • View Profile
    • my company web site
Re: Developing a Weather Plugin, videos
« Reply #102 on: March 11, 2015, 11:17:43 am »

SBCC

  • Guru
  • ****
  • Posts: 164
    • View Profile
Re: Developing a Weather Plugin, videos
« Reply #103 on: March 18, 2015, 12:14:50 am »
Hi Guys

Sorry I've been distracted.

Carlos I did not have a chance to look at your code but I made some substantial changes to the code. It dose have an Open Weather Map option now.

I removed the mutexes and used the pluto mutexes... though I'm not completely sure how they work. There is a lot of code to look at there. I have 2 classes. 1 for NOAA and one for OWM (Open Weather Map). I will look at your code now Carlos and see how we can merge the two. Thanks for all your help!!

Here is the link to my code;

https://www.dropbox.com/sh/45peimybwaxyg74/AADVuE1L9x07A_5uif4yhSsqa?dl=0

Jim


phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Developing a Weather Plugin, videos
« Reply #104 on: March 21, 2015, 01:43:55 am »
 :D  You guys rock!  Let me know when things are tested enough for me to package it all up.  I've been super busy and haven't had a chance to do much testing with it beyond the earlier posts.

J.