(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 thatforecast.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.