feat: skeleton for e-paper dashboard for bathroom
This commit is contained in:
31
README.md
Normal file
31
README.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
## Traffic information
|
||||||
|
|
||||||
|
# `GOOGLE_API_KEY`
|
||||||
|
|
||||||
|
* `TRAFFIC_FROM`
|
||||||
|
|
||||||
|
* `TRAFFIC_1_THROUGH` - single intermediary point, route option 2
|
||||||
|
|
||||||
|
* `TRAFFIC_2_THROUGH` - single intermediary point, route option 2
|
||||||
|
|
||||||
|
* `TRAFFIC_TO`
|
||||||
|
|
||||||
|
## Air information
|
||||||
|
|
||||||
|
* `AIRLY_API_KEY`
|
||||||
|
|
||||||
|
* `LATITUDE`
|
||||||
|
|
||||||
|
* `LONGITUDE`
|
||||||
|
|
||||||
|
## Weather information
|
||||||
|
|
||||||
|
* `FORECASTIO_API_KEY` - forecast.io API key
|
||||||
|
|
||||||
|
* `LATITUDE`
|
||||||
|
|
||||||
|
* `LONGITUDE`
|
||||||
|
|
||||||
|
|
||||||
50
epaper.py
Executable file
50
epaper.py
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import requests
|
||||||
|
import time
|
||||||
|
|
||||||
|
class DisplaySegment:
|
||||||
|
""" validity - time in seconds how long the data is useful """
|
||||||
|
last_refresh = 0
|
||||||
|
validity = 1
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_data_text(self):
|
||||||
|
""" returns text formatted data """
|
||||||
|
|
||||||
|
now = time.time()
|
||||||
|
if self.last_refresh + self.validity < now:
|
||||||
|
logging.debug(f"Data from {self.last_refresh} older than {self.validity} seconds, refreshing")
|
||||||
|
self.update()
|
||||||
|
self.last_refresh = now
|
||||||
|
|
||||||
|
return self._get_data_text()
|
||||||
|
|
||||||
|
def _get_data_text(self):
|
||||||
|
""" real function to return true text formatted data """
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ClockSegment(DisplaySegment):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class TrafficSegment(DisplaySegment):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class WeatherSegment(DisplaySegment):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class AirSegment(DisplaySegment):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
pass
|
||||||
22
run.sh
Normal file
22
run.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export LATITUDE=
|
||||||
|
export LONGITUDE=
|
||||||
|
|
||||||
|
export GOOGLE_API_KEY=…
|
||||||
|
#export TRAFFIC_FROM=
|
||||||
|
export TRAFFIC_FROM="${LATITUDE}-${LONGITUDE}"
|
||||||
|
export TRAFFIC_1_THROUGH=6JV5+4FP
|
||||||
|
export TRAFFIC_2_THROUGH=7JFQ+V8P
|
||||||
|
export TRAFFIC_TO=6JXP+GX
|
||||||
|
|
||||||
|
## Air information
|
||||||
|
|
||||||
|
export AIRLY_API_KEY=…
|
||||||
|
|
||||||
|
## Weather information
|
||||||
|
|
||||||
|
export FORECASTIO_API_KEY=
|
||||||
|
|
||||||
|
./epaper.py
|
||||||
|
|
||||||
Reference in New Issue
Block a user