Tesla wall connector add sensors (#117769)
parent
0fb78b3ab3
commit
d0b1ac6918
|
@ -77,6 +77,24 @@ WALL_CONNECTOR_SENSORS = [
|
|||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
WallConnectorSensorDescription(
|
||||
key="pcba_temp_c",
|
||||
translation_key="pcba_temp_c",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
value_fn=lambda data: round(data[WALLCONNECTOR_DATA_VITALS].pcba_temp_c, 1),
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
WallConnectorSensorDescription(
|
||||
key="mcu_temp_c",
|
||||
translation_key="mcu_temp_c",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
value_fn=lambda data: round(data[WALLCONNECTOR_DATA_VITALS].mcu_temp_c, 1),
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
WallConnectorSensorDescription(
|
||||
key="grid_v",
|
||||
translation_key="grid_v",
|
||||
|
|
|
@ -51,6 +51,12 @@
|
|||
"handle_temp_c": {
|
||||
"name": "Handle temperature"
|
||||
},
|
||||
"pcba_temp_c": {
|
||||
"name": "PCB temperature"
|
||||
},
|
||||
"mcu_temp_c": {
|
||||
"name": "MCU temperature"
|
||||
},
|
||||
"grid_v": {
|
||||
"name": "Grid voltage"
|
||||
},
|
||||
|
|
|
@ -20,6 +20,12 @@ async def test_sensors(hass: HomeAssistant) -> None:
|
|||
EntityAndExpectedValues(
|
||||
"sensor.tesla_wall_connector_handle_temperature", "25.5", "-1.4"
|
||||
),
|
||||
EntityAndExpectedValues(
|
||||
"sensor.tesla_wall_connector_pcb_temperature", "30.5", "-1.2"
|
||||
),
|
||||
EntityAndExpectedValues(
|
||||
"sensor.tesla_wall_connector_mcu_temperature", "42.0", "-1"
|
||||
),
|
||||
EntityAndExpectedValues(
|
||||
"sensor.tesla_wall_connector_grid_voltage", "230.2", "229.2"
|
||||
),
|
||||
|
@ -55,6 +61,8 @@ async def test_sensors(hass: HomeAssistant) -> None:
|
|||
mock_vitals_first_update = get_vitals_mock()
|
||||
mock_vitals_first_update.evse_state = 1
|
||||
mock_vitals_first_update.handle_temp_c = 25.51
|
||||
mock_vitals_first_update.pcba_temp_c = 30.5
|
||||
mock_vitals_first_update.mcu_temp_c = 42.0
|
||||
mock_vitals_first_update.grid_v = 230.15
|
||||
mock_vitals_first_update.grid_hz = 50.021
|
||||
mock_vitals_first_update.voltageA_v = 230.1
|
||||
|
@ -68,6 +76,8 @@ async def test_sensors(hass: HomeAssistant) -> None:
|
|||
mock_vitals_second_update = get_vitals_mock()
|
||||
mock_vitals_second_update.evse_state = 3
|
||||
mock_vitals_second_update.handle_temp_c = -1.42
|
||||
mock_vitals_second_update.pcba_temp_c = -1.2
|
||||
mock_vitals_second_update.mcu_temp_c = -1
|
||||
mock_vitals_second_update.grid_v = 229.21
|
||||
mock_vitals_second_update.grid_hz = 49.981
|
||||
mock_vitals_second_update.voltageA_v = 228.1
|
||||
|
|
Loading…
Reference in New Issue