Esempio n. 1
0
 def set(self, bat_state: BatState):
     try:
         pub_to_broker("openWB/set/bat/" + str(self.num) + "/get/power",
                       bat_state.power, 2)
         pub_to_broker("openWB/set/bat/" + str(self.num) + "/get/soc",
                       bat_state.soc, 0)
         pub_to_broker("openWB/set/bat/" + str(self.num) + "/get/imported",
                       bat_state.imported, 2)
         pub_to_broker("openWB/set/bat/" + str(self.num) + "/get/exported",
                       bat_state.exported, 2)
     except Exception as e:
         process_error(e)
Esempio n. 2
0
 def set(self, inverter_state: InverterState):
     try:
         pub_to_broker("openWB/set/pv/" + str(self.num) + "/get/power", inverter_state.power, 2)
         pub_to_broker("openWB/set/pv/" + str(self.num) + "/get/counter", inverter_state.counter, 3)
         pub_to_broker("openWB/set/pv/" + str(self.num) + "/get/currents", inverter_state.currents, 1)
     except Exception as e:
         raise FaultState.from_exception(e)
Esempio n. 3
0
 def set(self, state: ChargepointState) -> None:
     pub_to_broker(
         "openWB/set/chargepoint/" + str(self.num) + "/get/voltages",
         state.voltages, 2)
     pub_to_broker(
         "openWB/set/chargepoint/" + str(self.num) + "/get/currents",
         state.currents, 2)
     pub_to_broker(
         "openWB/set/chargepoint/" + str(self.num) + "/get/power_factors",
         state.power_factors, 2)
     pub_to_broker(
         "openWB/set/chargepoint/" + str(self.num) + "/get/imported",
         state.imported, 2)
     pub_to_broker(
         "openWB/set/chargepoint/" + str(self.num) + "/get/exported",
         state.exported, 2)
     pub_to_broker("openWB/set/chargepoint/" + str(self.num) + "/get/power",
                   state.power, 2)
     pub_to_broker(
         "openWB/set/chargepoint/" + str(self.num) + "/get/phases_in_use",
         state.phases_in_use, 2)
     pub_to_broker(
         "openWB/set/chargepoint/" + str(self.num) + "/get/charge_state",
         state.charge_state, 2)
     pub_to_broker(
         "openWB/set/chargepoint/" + str(self.num) + "/get/plug_state",
         state.plug_state, 2)
     pub_to_broker(
         "openWB/set/chargepoint/" + str(self.num) + "/get/read_tag",
         state.read_tag)
Esempio n. 4
0
 def set(self, counter_state: CounterState):
     try:
         pub_to_broker(
             "openWB/set/counter/" + str(self.num) + "/get/voltages",
             counter_state.voltages, 2)
         pub_to_broker(
             "openWB/set/counter/" + str(self.num) + "/get/currents",
             counter_state.currents, 2)
         pub_to_broker(
             "openWB/set/counter/" + str(self.num) + "/get/powers",
             counter_state.powers, 2)
         pub_to_broker(
             "openWB/set/counter/" + str(self.num) + "/get/power_factors",
             counter_state.power_factors, 2)
         pub_to_broker(
             "openWB/set/counter/" + str(self.num) + "/get/imported",
             counter_state.imported)
         pub_to_broker(
             "openWB/set/counter/" + str(self.num) + "/get/exported",
             counter_state.exported)
         pub_to_broker("openWB/set/counter/" + str(self.num) + "/get/power",
                       counter_state.power)
         pub_to_broker(
             "openWB/set/counter/" + str(self.num) + "/get/frequency",
             counter_state.frequency)
     except Exception as e:
         process_error(e)
Esempio n. 5
0
 def set(self, state: CarState) -> None:
     pub_to_broker(self.topic, state.soc)