Changeset - ef97024d8644
[Not reviewed]
default
0 1 0
matthewreed - 9 years ago 2017-01-01 17:06:23

Added exception handling for database connection error in output logging
1 file changed with 12 insertions and 0 deletions:
0 comments (0 inline, 0 general)
hydrobot.py
Show inline comments
 
@@ -137,19 +137,31 @@ class CanBus:
 
        logger.info("Output! " + module + " " + output + " " + str(state))
 
        msg = self.msgdb.lookup_message(module)
 
        msg.lookup_signal(output).value = state
 
        self.queue.send(msg.encode())
 
        
 
        if msg.lookup_signal(output) == msg.Output1:
 
            try:
 
            MySeriesHelper(measurement='output_1', value=state)
 
            except:
 
                logger.error("Could not connect to database")
 
        if msg.lookup_signal(output) == msg.Output2:
 
            try:
 
            MySeriesHelper(measurement='output_2', value=state)
 
            except:
 
                logger.error("Could not connect to database")
 
        if msg.lookup_signal(output) == msg.Output3:
 
            try:
 
            MySeriesHelper(measurement='output_3', value=state)
 
            except:
 
                logger.error("Could not connect to database")
 
        if msg.lookup_signal(output) == msg.Output4:
 
            try:
 
            MySeriesHelper(measurement='output_4', value=state)
 
            except:
 
                logger.error("Could not connect to database")
 
        
 
        
 
class Scheduler:
 
    
 
    def __init__(self, canbus):
 
        self.canbus = canbus
0 comments (0 inline, 0 general)