|
|
|
@ -12,7 +12,7 @@ import pytz |
|
|
|
|
|
|
|
|
|
from APSystemsECUR import APSystemsECUR |
|
|
|
|
|
|
|
|
|
ECU_IP = '192.168.69.103' |
|
|
|
|
ECU_IP = '192.168.69.153' |
|
|
|
|
LISTEN_IP = '192.168.69.100' |
|
|
|
|
ecu = APSystemsECUR(ECU_IP) |
|
|
|
|
app = web.Application() |
|
|
|
@ -137,6 +137,10 @@ async def index(request): |
|
|
|
|
async def data(request): |
|
|
|
|
return web.json_response(solar_data) |
|
|
|
|
|
|
|
|
|
async def display(request): |
|
|
|
|
res = dict(power=solar_data['actual_total'], brightness=5) |
|
|
|
|
return web.json_response(res) |
|
|
|
|
|
|
|
|
|
async def history(request): |
|
|
|
|
try: |
|
|
|
|
date = datetime.strptime(request.match_info['date'], '%Y-%m-%d') |
|
|
|
@ -157,6 +161,7 @@ async def history(request): |
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
app.router.add_get('/', index) |
|
|
|
|
app.router.add_get('/data', data) |
|
|
|
|
app.router.add_get('/display', display) |
|
|
|
|
app.router.add_get('/history/{date}', history) |
|
|
|
|
|
|
|
|
|
loop = asyncio.get_event_loop() |
|
|
|
|