Skip to content

Commit

Permalink
Add plugged_waiting_for_charge option to renault plug state
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet committed Sep 6, 2024
1 parent 6b1fc00 commit a2372c0
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
8 changes: 7 additions & 1 deletion homeassistant/components/renault/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,13 @@ def _get_utc_value(entity: RenaultSensor[T]) -> datetime:
translation_key="plug_state",
device_class=SensorDeviceClass.ENUM,
entity_class=RenaultSensor[KamereonVehicleBatteryStatusData],
options=["unplugged", "plugged", "plug_error", "plug_unknown"],
options=[
"unplugged",
"plugged",
"plug_error",
"plug_unknown",
"plugged_waiting_for_charge",
],
value_lambda=_get_plug_state_formatted,
),
RenaultSensorEntityDescription(
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/renault/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@
"unplugged": "Unplugged",
"plugged": "Plugged in",
"plug_error": "Plug error",
"plug_unknown": "Plug unknown"
"plug_unknown": "Plug unknown",
"plugged_waiting_for_charge": "Plugged in waiting for charge"
}
},
"res_state": {
Expand Down
24 changes: 21 additions & 3 deletions tests/components/renault/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,13 @@
ATTR_DEVICE_CLASS: SensorDeviceClass.ENUM,
ATTR_ENTITY_ID: "sensor.reg_number_plug_state",
ATTR_ICON: "mdi:power-plug",
ATTR_OPTIONS: ["unplugged", "plugged", "plug_error", "plug_unknown"],
ATTR_OPTIONS: [
"unplugged",
"plugged",
"plug_error",
"plug_unknown",
"plugged_waiting_for_charge",
],
ATTR_STATE: "plugged",
ATTR_UNIQUE_ID: "vf1aaaaa555777999_plug_state",
},
Expand Down Expand Up @@ -487,7 +493,13 @@
ATTR_DEVICE_CLASS: SensorDeviceClass.ENUM,
ATTR_ENTITY_ID: "sensor.reg_number_plug_state",
ATTR_ICON: "mdi:power-plug-off",
ATTR_OPTIONS: ["unplugged", "plugged", "plug_error", "plug_unknown"],
ATTR_OPTIONS: [
"unplugged",
"plugged",
"plug_error",
"plug_unknown",
"plugged_waiting_for_charge",
],
ATTR_STATE: "unplugged",
ATTR_UNIQUE_ID: "vf1aaaaa555777999_plug_state",
},
Expand Down Expand Up @@ -725,7 +737,13 @@
ATTR_DEVICE_CLASS: SensorDeviceClass.ENUM,
ATTR_ENTITY_ID: "sensor.reg_number_plug_state",
ATTR_ICON: "mdi:power-plug",
ATTR_OPTIONS: ["unplugged", "plugged", "plug_error", "plug_unknown"],
ATTR_OPTIONS: [
"unplugged",
"plugged",
"plug_error",
"plug_unknown",
"plugged_waiting_for_charge",
],
ATTR_STATE: "plugged",
ATTR_UNIQUE_ID: "vf1aaaaa555777123_plug_state",
},
Expand Down
12 changes: 12 additions & 0 deletions tests/components/renault/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'config_entry_id': <ANY>,
Expand Down Expand Up @@ -923,6 +924,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'context': <ANY>,
Expand Down Expand Up @@ -1251,6 +1253,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'config_entry_id': <ANY>,
Expand Down Expand Up @@ -1676,6 +1679,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'context': <ANY>,
Expand Down Expand Up @@ -2002,6 +2006,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'config_entry_id': <ANY>,
Expand Down Expand Up @@ -2458,6 +2463,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'context': <ANY>,
Expand Down Expand Up @@ -3106,6 +3112,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'config_entry_id': <ANY>,
Expand Down Expand Up @@ -3533,6 +3540,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'context': <ANY>,
Expand Down Expand Up @@ -3861,6 +3869,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'config_entry_id': <ANY>,
Expand Down Expand Up @@ -4286,6 +4295,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'context': <ANY>,
Expand Down Expand Up @@ -4612,6 +4622,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'config_entry_id': <ANY>,
Expand Down Expand Up @@ -5068,6 +5079,7 @@
'plugged',
'plug_error',
'plug_unknown',
'plugged_waiting_for_charge',
]),
}),
'context': <ANY>,
Expand Down

0 comments on commit a2372c0

Please sign in to comment.