Python Forum
Python code weather Led sign
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python code weather Led sign
#5
(May-07-2017, 04:39 PM)buran Wrote: it looks like you try to use script written by someone else and add the functionality you need. As it is all the forecast data are not accessible outside main() function. Also, your description, that it  reads literally 'forecast.currently', suggest that you pass just that sting. so, not able to test, but would suggest something like this

#!/usr/bin/python
import datetime
import forecastio
from pyledsign.minisign import MiniSign

def main():
"""
Run load_forecast() with the given lat, lng, and time arguments.
"""

   api_key = "My actual key is here, I just took it out for sample"

   lat = -31.967819
   lng = 115.87718
   time = datetime.datetime(2017, 06, 05, 6, 0, 0)

   forecast = forecastio.load_forecast(api_key, lat, lng, time=time)

   mysign = MiniSign(devicetype='sign')

   print "===========Currently Data========="
   current_forecast =  forecast.currently()
   print current_forecast
   # queuemsg queues a message to be sent with the send method
   mysign.queuemsg(data=current_forecast)
   mysign.sendqueue(device='/dev/ttyUSB0')
   

   print "===========Hourly Data========="
   by_hour = forecast.hourly()
   print "Hourly Summary: %s" % (by_hour.summary)

   for hourly_data_point in by_hour.data:
      print hourly_data_point

   print "===========Daily Data========="
   by_day = forecast.daily()
   print "Daily Summary: %s" % (by_day.summary)

   for daily_data_point in by_day.data:
       print daily_data_point


if __name__ == "__main__":
   main()
this assumes that forecast.currently() actually returns string, that can be passed to your device to read it.

thanks! I've never written code for python until yesterday, just trying to figure out how to get the weather information working but could not find many sources on it besides the links I've put in the post above this one. That's why it's copied and pasted, I wouldn't know how to write my own.
Reply


Messages In This Thread
Python code weather Led sign - by n3vo - May-07-2017, 01:48 PM
RE: Python code weather Led sign - by Larz60+ - May-07-2017, 04:14 PM
RE: Python code weather Led sign - by n3vo - May-07-2017, 05:38 PM
RE: Python code weather Led sign - by buran - May-07-2017, 04:39 PM
RE: Python code weather Led sign - by n3vo - May-07-2017, 08:30 PM
RE: Python code weather Led sign - by buran - May-07-2017, 08:33 PM
RE: Python code weather Led sign - by n3vo - May-08-2017, 12:35 AM
RE: Python code weather Led sign - by buran - May-08-2017, 07:07 AM
RE: Python code weather Led sign - by n3vo - May-16-2017, 06:09 PM
RE: Python code weather Led sign - by buran - May-16-2017, 07:35 PM
RE: Python code weather Led sign - by n3vo - May-16-2017, 08:29 PM
RE: Python code weather Led sign - by buran - May-16-2017, 08:38 PM
RE: Python code weather Led sign - by buran - May-16-2017, 08:59 PM
RE: Python code weather Led sign - by n3vo - May-17-2017, 01:38 PM
RE: Python code weather Led sign - by buran - May-17-2017, 01:47 PM
RE: Python code weather Led sign - by sparkz_alot - May-17-2017, 02:20 PM
RE: Python code weather Led sign - by buran - May-17-2017, 02:23 PM
RE: Python code weather Led sign - by n3vo - May-17-2017, 03:16 PM
RE: Python code weather Led sign - by buran - May-17-2017, 03:53 PM
RE: Python code weather Led sign - by n3vo - May-17-2017, 05:57 PM
RE: Python code weather Led sign - by buran - May-17-2017, 06:43 PM
RE: Python code weather Led sign - by n3vo - May-17-2017, 07:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Does @ at sign used for tother than decorators? ggpython000 1 579 Oct-12-2023, 09:08 AM
Last Post: buran
  Python rule about the space character surrounding the equal sign ineuw 10 1,778 Sep-21-2023, 09:17 AM
Last Post: ineuw
  Need to sign JWT token with JWK key stucoder 1 1,722 Feb-21-2022, 09:04 AM
Last Post: stucoder
  i making a terminal sign up website thing Kenrichppython 1 1,739 Nov-04-2021, 03:57 AM
Last Post: bowlofred
  Style question on adherence to PEP 8 with whitespace near an "=" sign nilesh 6 4,010 Jan-12-2021, 11:11 PM
Last Post: snippsat
  Mathematical Conversion Scripts for Weather Station Mickey53usa 11 4,764 Jun-24-2020, 03:14 AM
Last Post: buran
  Parsing Date/Time from Metar Reports with 6 hourly weather information Lawrence 0 2,382 May-03-2020, 08:15 PM
Last Post: Lawrence
  Syntax Error with = sign and more Kathleen57 3 2,701 May-03-2020, 03:52 AM
Last Post: buran
  Handling pound sign (#) within custom URL chisox721 5 6,651 Apr-02-2019, 10:01 PM
Last Post: chisox721
  Sign XADES-EPES Python pedro86porras 2 4,278 Nov-02-2018, 04:31 PM
Last Post: pedro86porras

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020