-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Matter EVSE (button entities version) #133662
Conversation
Remove `node` object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add the evse_charging
fixture to the list of fixtures in the conftest.py
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
You probably have to execute |
I will do that |
MatterDiscoverySchema( | ||
platform=Platform.BUTTON, | ||
entity_description=MatterButtonEntityDescription( | ||
key="EnergyEvseEnableChargingButton", | ||
translation_key="enable_charging", | ||
command=clusters.EnergyEvse.Commands.EnableCharging( | ||
chargingEnabledUntil=NullValue, | ||
minimumChargeCurrent=0, | ||
maximumChargeCurrent=0, | ||
), | ||
command_timeout=3000, | ||
), | ||
entity_class=MatterCommandButton, | ||
required_attributes=(clusters.EnergyEvse.Attributes.AcceptedCommandList,), | ||
allow_multi=True, | ||
), | ||
MatterDiscoverySchema( | ||
platform=Platform.BUTTON, | ||
entity_description=MatterButtonEntityDescription( | ||
key="EnergyEvseDisableChargingButton", | ||
translation_key="disable_charging", | ||
command=clusters.EnergyEvse.Commands.Disable, | ||
command_timeout=3000, | ||
), | ||
entity_class=MatterCommandButton, | ||
required_attributes=(clusters.EnergyEvse.Attributes.AcceptedCommandList,), | ||
allow_multi=True, | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So one question arose here for me is: Do we have a state for this? Because if we do, wouldn't this be a switch?
Note: I am not up to date on any matter specs, so you might know more here, but please enlighten me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is a State attribute in the specs: 24-27350-005_Matter-1.4-Application-Cluster-Specification.pdf page 661
9.3.8.1. State Attribute
This attribute SHALL indicate the current status of the EVSE. This higher-level status is partly derived from the signaling protocol as communicated between the EVSE and the vehicle through the pilot signal.
The State attribute SHALL change when the EVSE detects change of condition of the EV (plugged in or unplugged, whether the vehicle is asking for demand or not, and if it is charging or discharging).
It's implemented here:
core/homeassistant/components/matter/sensor.py
Lines 74 to 82 in f1ba30e
EVSE_STATE_MAP = { | |
clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn: "not_plugged_in", | |
clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand: "plugged_in_no_demand", | |
clusters.EnergyEvse.Enums.StateEnum.kPluggedInDemand: "plugged_in_demand", | |
clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging: "plugged_in_charging", | |
clusters.EnergyEvse.Enums.StateEnum.kPluggedInDischarging: "plugged_in_discharging", | |
clusters.EnergyEvse.Enums.StateEnum.kSessionEnding: "session_ending", | |
clusters.EnergyEvse.Enums.StateEnum.kFault: "fault", | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure exposing this as a switch will be the best way of doing this.
clusters.EnergyEvse.Attributes.SupplyState
is an enum attribute. So we would have to:
- Create a new representation of a Matter switch
- map switch state to enum values
- handle two On/Off commands
- EnableCharging
- EnergyEvse.Commands.Disable,
- handle arguments for EnableCharging command (chargingEnabledUntil, minimumChargeCurrent, maximumChargeCurrent) and get values from other entities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Matter switch platform recently got a new variant to base the switch on enum/int values so we have some plumbing present to do this. Also the state is mandatory so there always be a state present. Worst case you can set it None which will be handled by HA (and just show both options).
I would also keep the enum string sensor with the more detailed state.
So yeah I agree with Joost here that the 2 buttons to enable/disable charging should be a single switch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we need to define a new EntityDescription capable of receiving Matter on and off commands and their arguments as arguments. Like this:
MatterDiscoverySchema(
platform=Platform.SWITCH,
entity_description=SwitchEntityDescription(
key="EnergyEvseEnableDisableCharging",
name=None,
on_command=lambda: clusters.EnergyEvse.Commands.EnableCharging(
chargingEnabledUntil=NullValue,
minimumChargeCurrent=0,
maximumChargeCurrent=0,
),
off_command=clusters.EnergyEvse.Commands.Disable,
command_timeout=3000,
),
entity_class=MatterGenericCommandSwitch,
required_attributes=(clusters.EnergyEvse.Attributes.AcceptedCommandList,),
value_contains=clusters.EnergyEvse.Commands.EnableCharging.command_id,
allow_multi=True,
),
converted to draft because the enable_charging should be a switch. |
I'm replacing this request with this one, as this one requires too many changes to adapt and resolve all the conflicts: |
Proposed change
Support for Matter EVSE - EnergyEvse cluster
Matter 1.3’s energy features enable new energy-centric devices, the first of which is Electric Vehicle Supply Equipment (EVSE).
As discussed with Marcel, the second step would be to create a specific entity for EVSE in Home Assistant for better integration.
Supported attributes:
Changes
Add
command_timeout attribute
inMatterButtonEntityDescription
class. This is mandatory forEnergyEvse
commands.Type of change
Additional information
Testing
Testing with Matter Linux Energy Management Example device from SDK.
Enable charging with chip-tool
Enable charging with WebSocket
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: