Skip to content

Commit

Permalink
Merge pull request #105 from V2G-liberty/103-featurerequest-change-ch…
Browse files Browse the repository at this point in the history
…arge-mode-off-to-pause-and-keep-polling-charger

 FeatureRequest 🛠️: Change charge mode "Off" to "Pause" and keep poling charger (#102)
  • Loading branch information
ArdJonker authored Oct 2, 2024
2 parents e87a157 + 3f5c993 commit cf1e603
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ async def set_inactive(self):
"""To be called when charge_mode in UI is (switched to) Stop"""
self.log("evse: set_inactive called")
await self.stop_charging()
await self.__cancel_polling(reason="Set inactive called")
# await self.__cancel_polling(reason="Set inactive called")
await self.__set_charger_control("give")
self._am_i_active = False

Expand Down Expand Up @@ -873,8 +873,8 @@ async def __set_charge_power(self, charge_power: int, skip_min_soc_check: bool =
######################################################################

async def __update_poll_indicator_in_ui(self, reset: bool = False):
# This can be shown directly as text in the UI (or use ⏲ ⟳ 🔃 🔄?) but,
# as the "last_changed" attribute also changes, an "age" could be shown based on this as well
# Toggles the char in the UI to indicate polling activity,
# as the "last_changed" attribute also changes, an "age" could be shown based on this as well.
self.poll_update_text = "↺" if self.poll_update_text != "↺" else "↻"
if reset:
self.poll_update_text = ""
Expand Down Expand Up @@ -1190,6 +1190,7 @@ async def __modbus_un_recoverable_error(self, reason: str = None, source:str = N
await self.__cancel_polling(reason="un_recoverable modbus error")
# The only exception to the rule that _am_i_active should only be set from "set_(in)active()"
self._am_i_active = False
await self.__cancel_polling()
await self.v2g_main_app.notify_user_of_charger_needs_restart(
was_car_connected=await self.is_car_connected()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,18 +535,40 @@ views:
padding: 10% 0 !important;
}
- type: button
name: "Off"
name: "Pause"
icon: mdi:pause-box-outline
hold_action:
action: none
entity: input_boolean.chargemodeoff
icon_height: 40px
show_state: false
card_mod:
style: |
# Overflow is needed as otherwise the popup is cut-off outside of the button (and then useless).
:host * {
overflow: visible !important;
}
ha-card {
padding: 10% 0 !important;
}
ha-card:hover::before {
content: "Pause scheduled charging and give control to the charger. \A Want to stop V2G Liberty completely? Use the link on the settings tab in the top bar.";
text-align: left;
white-space: pre-wrap;
font-size: 80%;
color: var(--primary-text-color);
position: absolute !important;
width: 240px;
right: 12px;
top: 96px;
background-color: var(--primary-background-color);
border: 1px solid var(--input-idle-line-color);
border-radius: 8px;
padding: 8px 16px;
z-index: 110;
}
square: false

- type: conditional
conditions:
- entity: input_text.charger_state
Expand Down Expand Up @@ -1351,7 +1373,7 @@ views:
entities:
- type: button
name: ' '
action_name: Restart V2G Liberty
action_name: 🔄 Restart V2G Liberty ››
tap_action:
action: call-service
confirmation:
Expand All @@ -1360,7 +1382,16 @@ views:
target: {}
- type: button
name: ' '
action_name: Reset to factory defaults >>
action_name: 🛑 Stop V2G Liberty ››
tap_action:
action: call-service
confirmation:
text: The only way to stop V2G Liberty is to stop the add-on. Goto Settings -> Add-ons -> V2G Liberty -> Stop
service: script.stop_v2g_liberty
target: {}
- type: button
name: ' '
action_name: 🏭 Reset to factory defaults ››
tap_action:
action: call-service
confirmation:
Expand Down

0 comments on commit cf1e603

Please sign in to comment.