Mercurial > ~darius > hgwebdir.cgi > epro
comparison eprodbus.py @ 16:3338e666256b
Move DB path to top of the file with the other knobs.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 06 Dec 2021 11:27:23 +1030 |
parents | 08b61687b75f |
children | 3067bb98b482 |
comparison
equal
deleted
inserted
replaced
15:08b61687b75f | 16:3338e666256b |
---|---|
33 #logger.addHandler(fh) | 33 #logger.addHandler(fh) |
34 logger.addHandler(ch) | 34 logger.addHandler(ch) |
35 | 35 |
36 logger.info(__file__ + " is starting up") | 36 logger.info(__file__ + " is starting up") |
37 | 37 |
38 dbpath = '/home/root/vanlogger/log.db' | |
38 port = 'ttyepro' | 39 port = 'ttyepro' |
39 servicename = 'com.victronenergy.battery.' + port | 40 servicename = 'com.victronenergy.battery.' + port |
40 instance = 0 | 41 instance = 0 |
41 | 42 |
42 class eProUpdater: | 43 class eProUpdater: |
166 dbusservice.add_path('/ConsumedAmphours', value = None) | 167 dbusservice.add_path('/ConsumedAmphours', value = None) |
167 | 168 |
168 s = serial.Serial('/dev/' + port, 2400, parity = 'E') | 169 s = serial.Serial('/dev/' + port, 2400, parity = 'E') |
169 s.timeout = 0.1 | 170 s.timeout = 0.1 |
170 | 171 |
171 dbh = sqlite3.connect('/home/root/vanlogger/log.db') | 172 dbh = sqlite3.connect(dbpath) |
172 | 173 |
173 updater = eProUpdater(dbusservice, s, dbh) | 174 updater = eProUpdater(dbusservice, s, dbh) |
174 | 175 |
175 logger.info('Starting main loop') | 176 logger.info('Starting main loop') |
176 mainloop = gobject.MainLoop() | 177 mainloop = gobject.MainLoop() |