From 0c56791d9477f277494cc3886ae479b1ed1a46e8 Mon Sep 17 00:00:00 2001
From: kurens <40004079+migrzyb@users.noreply.github.com>
Date: Tue, 4 Feb 2025 18:16:59 +0100
Subject: [PATCH] Added support for One Time Charge Status to Vicare (#135984)

Co-authored-by: Christopher Fenner <9592452+CFenner@users.noreply.github.com>
Co-authored-by: kurens <migrzyb@users.noreply.github.com>
Co-authored-by: Dave T <17680170+davet2001@users.noreply.github.com>
Co-authored-by: Christopher Fenner <Christopher.Fenner@me.com>
---
 .../components/vicare/binary_sensor.py        |  6 +++
 homeassistant/components/vicare/icons.json    |  3 ++
 homeassistant/components/vicare/strings.json  |  3 ++
 .../vicare/snapshots/test_binary_sensor.ambr  | 47 +++++++++++++++++++
 4 files changed, 59 insertions(+)

diff --git a/homeassistant/components/vicare/binary_sensor.py b/homeassistant/components/vicare/binary_sensor.py
index 61a5abce942..9d216404156 100644
--- a/homeassistant/components/vicare/binary_sensor.py
+++ b/homeassistant/components/vicare/binary_sensor.py
@@ -106,6 +106,12 @@ GLOBAL_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
         device_class=BinarySensorDeviceClass.RUNNING,
         value_getter=lambda api: api.getDomesticHotWaterPumpActive(),
     ),
+    ViCareBinarySensorEntityDescription(
+        key="one_time_charge",
+        translation_key="one_time_charge",
+        device_class=BinarySensorDeviceClass.RUNNING,
+        value_getter=lambda api: api.getOneTimeCharge(),
+    ),
 )
 
 
diff --git a/homeassistant/components/vicare/icons.json b/homeassistant/components/vicare/icons.json
index 52148b1fa32..c54be7af0d5 100644
--- a/homeassistant/components/vicare/icons.json
+++ b/homeassistant/components/vicare/icons.json
@@ -18,6 +18,9 @@
       },
       "domestic_hot_water_pump": {
         "default": "mdi:pump"
+      },
+      "one_time_charge": {
+        "default": "mdi:shower-head"
       }
     },
     "button": {
diff --git a/homeassistant/components/vicare/strings.json b/homeassistant/components/vicare/strings.json
index 26ca0f5a264..50eeaf038e0 100644
--- a/homeassistant/components/vicare/strings.json
+++ b/homeassistant/components/vicare/strings.json
@@ -63,6 +63,9 @@
       },
       "domestic_hot_water_pump": {
         "name": "DHW pump"
+      },
+      "one_time_charge": {
+        "name": "One-time charge"
       }
     },
     "button": {
diff --git a/tests/components/vicare/snapshots/test_binary_sensor.ambr b/tests/components/vicare/snapshots/test_binary_sensor.ambr
index f3e4d4e1c84..ec2451cd466 100644
--- a/tests/components/vicare/snapshots/test_binary_sensor.ambr
+++ b/tests/components/vicare/snapshots/test_binary_sensor.ambr
@@ -373,6 +373,53 @@
     'state': 'unavailable',
   })
 # ---
+# name: test_all_entities[binary_sensor.model0_one_time_charge-entry]
+  EntityRegistryEntrySnapshot({
+    'aliases': set({
+    }),
+    'area_id': None,
+    'capabilities': None,
+    'config_entry_id': <ANY>,
+    'device_class': None,
+    'device_id': <ANY>,
+    'disabled_by': None,
+    'domain': 'binary_sensor',
+    'entity_category': None,
+    'entity_id': 'binary_sensor.model0_one_time_charge',
+    'has_entity_name': True,
+    'hidden_by': None,
+    'icon': None,
+    'id': <ANY>,
+    'labels': set({
+    }),
+    'name': None,
+    'options': dict({
+    }),
+    'original_device_class': <BinarySensorDeviceClass.RUNNING: 'running'>,
+    'original_icon': None,
+    'original_name': 'One-time charge',
+    'platform': 'vicare',
+    'previous_unique_id': None,
+    'supported_features': 0,
+    'translation_key': 'one_time_charge',
+    'unique_id': 'gateway0_deviceSerialVitodens300W-one_time_charge',
+    'unit_of_measurement': None,
+  })
+# ---
+# name: test_all_entities[binary_sensor.model0_one_time_charge-state]
+  StateSnapshot({
+    'attributes': ReadOnlyDict({
+      'device_class': 'running',
+      'friendly_name': 'model0 One-time charge',
+    }),
+    'context': <ANY>,
+    'entity_id': 'binary_sensor.model0_one_time_charge',
+    'last_changed': <ANY>,
+    'last_reported': <ANY>,
+    'last_updated': <ANY>,
+    'state': 'unavailable',
+  })
+# ---
 # name: test_binary_sensors[burner]
   StateSnapshot({
     'attributes': ReadOnlyDict({
-- 
GitLab