Ejemplo n.º 1
0
 def close(self, event):
     log.debug("Closing LTCBackend")
     try:
         self.ignite(False)
     except PhidgetException:
         log.info("Unable to turn off ignite on quit")
     self.relay.close()
     self.core.close()
Ejemplo n.º 2
0
 def close(self, event):
     log.debug("Closing LTCBackend")
     try:
         self.ignite(False)
     except PhidgetException:
         log.info("Unable to turn off ignite on quit")
     self.relay.close()
     self.core.close()
Ejemplo n.º 3
0
    def __init__(self, set_status):
        log.info("Starting Backend")
        self.relay = IgnitionRelay()
        self.relay.add_callback(self.attach, "attach")

        self.core = CorePhidget()
        self.core.add_callback(self.attach, "attach")
        self.relay.shorepower.add_callback(self.output, 'value')

        self.set_status = set_status
Ejemplo n.º 4
0
    def __init__(self, set_status):
        log.info("Starting Backend")
        self.relay = IgnitionRelay()
        self.relay.add_callback(self.attach, "attach")

        self.core = CorePhidget()
        self.core.add_callback(self.attach, "attach")
        self.relay.shorepower.add_callback(self.output, 'value')

        self.set_status = set_status
Ejemplo n.º 5
0
    def on_value(self, event):
        try:
            val = event.value
        except AttributeError:
            val = event.state

        if val is 0:  # The sensors seem to return 0 when absent.
            self.status_ind.set_state('Unknown', 'Not Found')
            return

        newval = self.conversion(val)
        log.info("{}: {}{}".format(self.name, newval, self.unit))
        if isinstance(newval, str):
            self.status_ind.text = '{} {}'.format(newval, self.unit)
        else:
            self.status_ind.text = '{:.1f} {}'.format(newval, self.unit)

        self.status_ind.background_color = self.nominal_value(newval)
Ejemplo n.º 6
0
    def on_value(self, event):
        try:
            val = event.value
        except AttributeError:
            val = event.state

        if val is 0:  # The sensors seem to return 0 when absent.
            self.status_ind.set_state('Unknown', 'Not Found')
            return

        newval = self.conversion(val)
        log.info("{}: {}{}".format(self.name, newval, self.unit))
        if isinstance(newval, str):
            self.status_ind.text = '{} {}'.format(newval, self.unit)
        else:
            self.status_ind.text = '{:.1f} {}'.format(newval, self.unit)

        self.status_ind.background_color = self.nominal_value(newval)
Ejemplo n.º 7
0
 def setShorepowerState(self, state):
     log.info("Setting shorepower state to {}".format(state))
     self.ik.setOutputState(self.shorepower.index, state)
Ejemplo n.º 8
0
 def setIgnitionRelayState(self, state):
     log.info("Setting ignition relay state to {}".format(state))
     self.ik.setOutputState(self.relay.index, state)
Ejemplo n.º 9
0
 def set_state(self, state):
     log.info("State changed:{}".format(state))
     self.state_info.text = state
     self.state_info.color = self.states[state][1]
     self.state_message.text = self.states[state][0]
Ejemplo n.º 10
0
        relay_panel.add_widget(sens4)
        relay_panel.add_widget(relay2)
        relay_panel.add_widget(sens6)
        relay_panel.add_widget(relay1)
        relay_panel.add_widget(sens9)

        backend.core.add_callback(status.on_attach, 'attach')
        backend.core.add_callback(status.on_detach, 'detach')
        backend.core.add_callback(status.on_error, 'error')

        backend.relay.add_callback(status.on_attach, 'attach')
        backend.relay.add_callback(status.on_detach, 'detach')
        backend.relay.add_callback(status.on_error, 'error')
        backend.relay.relay.add_callback(status.on_ignite, 'value')

        ctrl = LTCctrl(backend.ignite, backend.shorepower, status.set_state)
        backend.relay.shorepower.add_callback(ctrl.on_shorepower, "value")
        backend.relay.relay.add_callback(ctrl.on_ignite, "value")

        ltc = LTC()
        ltc.toplayout.add_widget(ctrl)
        ltc.toplayout.add_widget(status)
        ltc.indicators.add_widget(relay_panel)
        ltc.indicators.add_widget(input_panel)
        return ltc


if __name__ == '__main__':
    log.info("Starting LTCCOM")
    LTCApp().run()
Ejemplo n.º 11
0
 def setShorepowerState(self, state):
     log.info("Setting shorepower state to {}".format(state))
     self.ik.setOutputState(self.shorepower.index, state)
Ejemplo n.º 12
0
 def setIgnitionRelayState(self, state):
     log.info("Setting ignition relay state to {}".format(state))
     self.ik.setOutputState(self.relay.index, state)
Ejemplo n.º 13
0
 def set_state(self, state):
     log.info("State changed:{}".format(state))
     self.state_info.text = state
     self.state_info.color = self.states[state][1]
     self.state_message.text = self.states[state][0]
Ejemplo n.º 14
0
        relay_panel.add_widget(sens4)
        relay_panel.add_widget(relay2)
        relay_panel.add_widget(sens6)
        relay_panel.add_widget(relay1)
        relay_panel.add_widget(sens9)

        backend.core.add_callback(status.on_attach, 'attach')
        backend.core.add_callback(status.on_detach, 'detach')
        backend.core.add_callback(status.on_error, 'error')

        backend.relay.add_callback(status.on_attach, 'attach')
        backend.relay.add_callback(status.on_detach, 'detach')
        backend.relay.add_callback(status.on_error, 'error')
        backend.relay.relay.add_callback(status.on_ignite, 'value')

        ctrl = LTCctrl(backend.ignite, backend.shorepower, status.set_state)
        backend.relay.shorepower.add_callback(ctrl.on_shorepower, "value")
        backend.relay.relay.add_callback(ctrl.on_ignite, "value")

        ltc = LTC()
        ltc.toplayout.add_widget(ctrl)
        ltc.toplayout.add_widget(status)
        ltc.indicators.add_widget(relay_panel)
        ltc.indicators.add_widget(input_panel)
        return ltc

if __name__ == '__main__':
    log.info("Starting LTCCOM")
    LTCApp().run()