File tree Expand file tree Collapse file tree 2 files changed +15
-11
lines changed
actor/power_distributing/_component_status Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -75,14 +75,17 @@ def start(self) -> None:
7575 self ._tasks .add (asyncio .create_task (self ._run ()))
7676
7777 def _is_working (self , ev_data : EVChargerData ) -> bool :
78- """Return whether the given data indicates that the component is working."""
79- return (
80- ev_data .cable_state == EVChargerCableState .EV_PLUGGED
81- and ev_data .component_state
82- in (
83- EVChargerComponentState .READY ,
84- EVChargerComponentState .CHARGING ,
85- )
78+ """Return whether the given EV charger can be assigned power.
79+
80+ This is True when an EV is connected and the charger is in a healthy state.
81+ """
82+ return ev_data .cable_state in (
83+ EVChargerCableState .EV_PLUGGED ,
84+ EVChargerCableState .EV_LOCKED ,
85+ ) and ev_data .component_state in (
86+ EVChargerComponentState .READY ,
87+ EVChargerComponentState .CHARGING ,
88+ EVChargerComponentState .DISCHARGING ,
8689 )
8790
8891 def _is_stale (self , ev_data : EVChargerData ) -> bool :
Original file line number Diff line number Diff line change @@ -478,9 +478,10 @@ def is_ev_connected(self) -> bool:
478478 When the charger is not in an error state, whether an EV is connected to
479479 the charger.
480480 """
481- return self .component_state not in (
482- EVChargerComponentState .AUTHORIZATION_REJECTED ,
483- EVChargerComponentState .ERROR ,
481+ return self .component_state in (
482+ EVChargerComponentState .READY ,
483+ EVChargerComponentState .CHARGING ,
484+ EVChargerComponentState .DISCHARGING ,
484485 ) and self .cable_state in (
485486 EVChargerCableState .EV_LOCKED ,
486487 EVChargerCableState .EV_PLUGGED ,
You can’t perform that action at this time.
0 commit comments