def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._batterysystem = BatterySubsystem(dbusmonitor) self._solarsystem = SolarChargerSubsystem(dbusmonitor) self._multi = Multi(dbusmonitor, dbusservice) self._dbusservice.add_path('/Control/SolarChargeVoltage', value=0) self._dbusservice.add_path('/Control/SolarChargeCurrent', value=0) self._dbusservice.add_path('/Control/EffectiveChargeVoltage', value=None) self._dbusservice.add_path('/Control/BmsParameters', value=0) self._dbusservice.add_path('/Control/MaxChargeCurrent', value=0) self._dbusservice.add_path('/Control/Dvcc', value=1) self._dbusservice.add_path( '/Debug/BatteryOperationalLimits/SolarVoltageOffset', value=0, writeable=True) self._dbusservice.add_path( '/Debug/BatteryOperationalLimits/VebusVoltageOffset', value=0, writeable=True) self._dbusservice.add_path( '/Debug/BatteryOperationalLimits/CurrentOffset', value=0, writeable=True) self._dbusservice.add_path('/Dvcc/Alarms/FirmwareInsufficient', value=0) self._dbusservice.add_path('/Dvcc/Alarms/MultipleBatteries', value=0)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) if os.path.exists('/dev/gpio'): relays = sorted(glob('/dev/gpio/relay_*')) else: # FIXME When the CCGX grows /dev/gpio, we can kill this. relays = gpio_paths(RelayState.RELAY_PATH) if len(relays) == 0: logging.info('No relays found') return i = 0 for r in relays: path = os.path.join(r, 'value') dbus_path = '/Relay/{}/State'.format(i) self._relays[dbus_path] = path self._dbusservice.add_path( dbus_path, value=None, writeable=True, onchangecallback=self._on_relay_state_changed) i += 1 logging.info('Relays found: {}'.format(', '.join( self._relays.values()))) gobject.idle_add(exit_on_error, lambda: not self._update_relay_state()) gobject.timeout_add(5000, exit_on_error, self._update_relay_state)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) # Publish the battery configuration self._dbusservice.add_path('/Batteries', value=None) self._dbusservice.add_path('/AvailableBatteries', value=None) self._timer = gobject.timeout_add(5000, exit_on_error, self._on_timer)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('{}/LastStartTime'.format(PREFIX), None, gettextcallback=lambda p, v: ts_to_str(v) if v is not None else '---')
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('/Control/SolarChargerVoltageSense', value=0) self._dbusservice.add_path('/Control/SolarChargerTemperatureSense', value=0) self._timer = gobject.timeout_add(3000, exit_on_error, self._on_timer)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('/Control/SolarChargerVoltageSense', value=0) self._dbusservice.add_path('/Control/BatteryVoltageSense', value=0) self._dbusservice.add_path('/Control/BatteryCurrentSense', value=0) self._dbusservice.add_path('/Control/SolarChargerTemperatureSense', value=0) self._dbusservice.add_path('/AvailableTemperatureServices', value=None) self._dbusservice.add_path('/AutoSelectedTemperatureService', value=None) self._dbusservice.add_path('/Dc/Battery/TemperatureService', value=None) self._dbusservice.add_path('/Dc/Battery/Temperature', value=None, gettextcallback=lambda p, v: '{:.1F} C'.format(v)) self._timer = GLib.timeout_add(3000, exit_on_error, self._on_timer)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._batterysystem = BatterySubsystem(dbusmonitor) self._solarsystem = SolarChargerSubsystem(dbusmonitor) self._multi = Multi(dbusmonitor, dbusservice) self._dbusservice.add_path('/Control/SolarChargeVoltage', value=0) self._dbusservice.add_path('/Control/SolarChargeCurrent', value=0) self._dbusservice.add_path('/Control/BmsParameters', value=0) self._dbusservice.add_path('/Control/MaxChargeCurrent', value=0) self._dbusservice.add_path('/Control/Dvcc', value=1) self._dbusservice.add_path('/Debug/BatteryOperationalLimits/SolarVoltageOffset', value=0, writeable=True) self._dbusservice.add_path('/Debug/BatteryOperationalLimits/VebusVoltageOffset', value=0, writeable=True) self._dbusservice.add_path('/Debug/BatteryOperationalLimits/CurrentOffset', value=0, writeable=True)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) relays = sorted(glob(self.RELAY_GLOB)) if len(relays) == 0: logging.info('No relays found') return self._relays.update({'/Relay/{}/State'.format(i): os.path.join(r, 'value') \ for i, r in enumerate(relays) }) gobject.idle_add(exit_on_error, self._init_relay_state) for dbus_path in self._relays.iterkeys(): self._dbusservice.add_path(dbus_path, value=None, writeable=True, onchangecallback=self._on_relay_state_changed) logging.info('Relays found: {}'.format(', '.join(self._relays.values())))
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) if os.path.exists('/dev/gpio'): relays = sorted(glob('/dev/gpio/relay_*')) else: # FIXME When the CCGX grows /dev/gpio, we can kill this. relays = gpio_paths(RelayState.RELAY_PATH) if len(relays) == 0: logging.info('No relays found') return i = 0 for r in relays: path = os.path.join(r, 'value') dbus_path = '/Relay/{}/State'.format(i) self._relays[dbus_path] = path self._dbusservice.add_path(dbus_path, value=None, writeable=True, onchangecallback=self._on_relay_state_changed) i += 1 logging.info('Relays found: {}'.format(', '.join(self._relays.values()))) gobject.idle_add(exit_on_error, lambda: not self._update_relay_state()) gobject.timeout_add(5000, exit_on_error, self._update_relay_state)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) # Find GPIO buzzer gpio_paths = sc_utils.gpio_paths(BuzzerControl.GPIO_BUZZER_PATH) if len(gpio_paths) > 0: self._gpio_path = os.path.join(gpio_paths[0], 'value') logging.info('GPIO buzzer found: {}'.format(self._gpio_path)) # Find PWM buzzer self._pwm_frequency = None try: pwm_frequency = sc_utils.gpio_paths(BuzzerControl.PWM_BUZZER_PATH) if len(pwm_frequency) > 0: self._pwm_frequency = int(pwm_frequency[0]) logging.info('PWM buzzer found @ frequency: {}'.format(self._pwm_frequency)) except ValueError: logging.error('Parsing of PWM buzzer settings at %s failed', BuzzerControl.PWM_BUZZER_PATH) if self._gpio_path is None and self._pwm_frequency is None: logging.info('No buzzer found') return self._dbusservice.add_path('/Buzzer/State', value=0, writeable=True, onchangecallback=lambda p, v: exit_on_error(self._on_buzzer_state_changed, v)) # Reset the buzzer so the buzzer state equals the D-Bus value. It will also silence the buzzer after # a restart of the service/system. self._set_buzzer(False)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('/Control/VebusSoc', value=0)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('/Dc/Battery/Alarms/CircuitBreakerTripped', value=None)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('/Control/ScheduledCharge', value=0)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('/Control/SolarChargerVoltageSense', value=0) self._dbusservice.add_path('/Control/SolarChargerTemperatureSense', value=0) self._timer = gobject.timeout_add(3000, exit_on_error, self._on_timer)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('/Dc/Battery/Alarms/CircuitBreakerTripped', value=None)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('/Control/ScheduledCharge', value=0)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('/Control/VebusSoc', value=0)
def set_sources(self, dbusmonitor, settings, dbusservice): SystemCalcDelegate.set_sources(self, dbusmonitor, settings, dbusservice) self._dbusservice.add_path('/Batteries', value=None) self._timer = gobject.timeout_add(5000, self._on_timer)