Coordinates extracted to config.py
This commit is contained in:
parent
0e2a063bd1
commit
65bfc63fc4
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
import geo
|
||||
import os
|
||||
import report
|
||||
|
||||
@ -8,6 +9,8 @@ MQTT_PASS = "password"
|
||||
MQTT_SERVER = "host"
|
||||
MQTT_TOPIC = "leyk"
|
||||
|
||||
GEO_POSITION = geo.gps.coordinate(lat=49.519167, lon=9.3672222)
|
||||
|
||||
#
|
||||
# Logging
|
||||
#
|
||||
|
@ -22,8 +22,6 @@ except ImportError:
|
||||
ROOT_LOGGER_NAME = 'root'
|
||||
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||
|
||||
geo_position = geo.gps.coordinate(lat=49.976596, lon=9.1481443)
|
||||
|
||||
|
||||
class pi_face(object):
|
||||
LOG_PREFIX = 'PiFace:'
|
||||
@ -237,10 +235,10 @@ class state_machine_day_state(state_machine.state_machine):
|
||||
return time.mktime(time.struct_time(tm))
|
||||
|
||||
def sunrise_time():
|
||||
return time.mktime(geo.sun.sunrise(geo_position)) + 30 * 60
|
||||
return time.mktime(geo.sun.sunrise(config.GEO_POSITION)) + 30 * 60
|
||||
|
||||
def sunset_time():
|
||||
return time.mktime(geo.sun.sunset(geo_position)) - 30 * 60
|
||||
return time.mktime(geo.sun.sunset(config.GEO_POSITION)) - 30 * 60
|
||||
|
||||
def sleep_time():
|
||||
tm = time.localtime()
|
||||
@ -286,7 +284,7 @@ class state_machine_day_state(state_machine.state_machine):
|
||||
return not self.sm_mode.this_state_is(self.sm_mode.STATE_AUTOMATIC)
|
||||
|
||||
def report_sunset_sunrise(self):
|
||||
state_machine.logger.debug('Sunrise: %s - Sunset: %s;', time.strftime("%H:%M", geo.sun.sunrise(geo_position)), time.strftime("%H:%M", geo.sun.sunset(geo_position))
|
||||
state_machine.logger.debug('Sunrise: %s - Sunset: %s;', time.strftime("%H:%M", geo.sun.sunrise(config.GEO_POSITION)), time.strftime("%H:%M", geo.sun.sunset(config.GEO_POSITION))
|
||||
)
|
||||
|
||||
|
||||
@ -479,10 +477,10 @@ class leyk(object):
|
||||
return time.mktime(time.struct_time(tm))
|
||||
|
||||
def sunrise_time(self):
|
||||
return time.mktime(geo.sun.sunrise(geo_position)) + 30 * 60
|
||||
return time.mktime(geo.sun.sunrise(config.GEO_POSITION)) + 30 * 60
|
||||
|
||||
def sunset_time(self):
|
||||
return time.mktime(geo.sun.sunset(geo_position)) - 30 * 60
|
||||
return time.mktime(geo.sun.sunset(config.GEO_POSITION)) - 30 * 60
|
||||
|
||||
def sleep_time(self):
|
||||
tm = time.localtime()
|
||||
|
Loading…
x
Reference in New Issue
Block a user