diff --git a/homeassistant/components/goalzero/binary_sensor.py b/homeassistant/components/goalzero/binary_sensor.py index db96fa0539b..6d53628f21e 100644 --- a/homeassistant/components/goalzero/binary_sensor.py +++ b/homeassistant/components/goalzero/binary_sensor.py @@ -21,23 +21,22 @@ PARALLEL_UPDATES = 0 BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = ( BinarySensorEntityDescription( key="backlight", - name="Backlight", + translation_key="backlight", icon="mdi:clock-digital", ), BinarySensorEntityDescription( key="app_online", - name="App online", + translation_key="app_online", device_class=BinarySensorDeviceClass.CONNECTIVITY, entity_category=EntityCategory.DIAGNOSTIC, ), BinarySensorEntityDescription( key="isCharging", - name="Charging", device_class=BinarySensorDeviceClass.BATTERY_CHARGING, ), BinarySensorEntityDescription( key="inputDetected", - name="Input detected", + translation_key="input_detected", device_class=BinarySensorDeviceClass.POWER, ), ) diff --git a/homeassistant/components/goalzero/sensor.py b/homeassistant/components/goalzero/sensor.py index 9001824d678..b9a83453d7f 100644 --- a/homeassistant/components/goalzero/sensor.py +++ b/homeassistant/components/goalzero/sensor.py @@ -31,14 +31,14 @@ from .entity import GoalZeroEntity SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( SensorEntityDescription( key="wattsIn", - name="Watts in", + translation_key="watts_in", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key="ampsIn", - name="Amps in", + translation_key="amps_in", device_class=SensorDeviceClass.CURRENT, native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, state_class=SensorStateClass.MEASUREMENT, @@ -46,14 +46,14 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( ), SensorEntityDescription( key="wattsOut", - name="Watts out", + translation_key="watts_out", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key="ampsOut", - name="Amps out", + translation_key="amps_out", device_class=SensorDeviceClass.CURRENT, native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, state_class=SensorStateClass.MEASUREMENT, @@ -61,7 +61,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( ), SensorEntityDescription( key="whOut", - name="Wh out", + translation_key="wh_out", device_class=SensorDeviceClass.ENERGY, native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, state_class=SensorStateClass.TOTAL_INCREASING, @@ -69,40 +69,38 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( ), SensorEntityDescription( key="whStored", - name="Wh stored", + translation_key="wh_stored", device_class=SensorDeviceClass.ENERGY, native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, state_class=SensorStateClass.TOTAL, ), SensorEntityDescription( key="volts", - name="Volts", device_class=SensorDeviceClass.VOLTAGE, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_registry_enabled_default=False, ), SensorEntityDescription( key="socPercent", - name="State of charge percent", + translation_key="soc_percent", device_class=SensorDeviceClass.BATTERY, native_unit_of_measurement=PERCENTAGE, ), SensorEntityDescription( key="timeToEmptyFull", - name="Time to empty/full", + translation_key="time_to_empty_full", device_class=SensorDeviceClass.DURATION, native_unit_of_measurement=UnitOfTime.MINUTES, ), SensorEntityDescription( key="temperature", - name="Temperature", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( key="wifiStrength", - name="Wi-Fi strength", + translation_key="wifi_strength", device_class=SensorDeviceClass.SIGNAL_STRENGTH, native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS, entity_registry_enabled_default=False, @@ -110,20 +108,20 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( ), SensorEntityDescription( key="timestamp", - name="Total run time", + translation_key="timestamp", native_unit_of_measurement=UnitOfTime.SECONDS, entity_registry_enabled_default=False, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( key="ssid", - name="Wi-Fi SSID", + translation_key="ssid", entity_registry_enabled_default=False, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( key="ipAddr", - name="IP address", + translation_key="ip_addr", entity_registry_enabled_default=False, entity_category=EntityCategory.DIAGNOSTIC, ), diff --git a/homeassistant/components/goalzero/strings.json b/homeassistant/components/goalzero/strings.json index 619b379c7a3..d94f5219607 100644 --- a/homeassistant/components/goalzero/strings.json +++ b/homeassistant/components/goalzero/strings.json @@ -22,5 +22,67 @@ "invalid_host": "[%key:common::config_flow::error::invalid_host%]", "unknown": "[%key:common::config_flow::error::unknown%]" } + }, + "entity": { + "binary_sensor": { + "backlight": { + "name": "Backlight" + }, + "app_online": { + "name": "App online" + }, + "input_detected": { + "name": "Input detected" + } + }, + "sensor": { + "watts_in": { + "name": "Power in" + }, + "amps_in": { + "name": "Current in" + }, + "watts_out": { + "name": "Power out" + }, + "amps_out": { + "name": "Current out" + }, + "wh_out": { + "name": "Energy out" + }, + "wh_stored": { + "name": "Energy stored" + }, + "soc_percent": { + "name": "State of charge percent" + }, + "time_to_empty_full": { + "name": "Time to empty/full" + }, + "wifi_strength": { + "name": "Wi-Fi strength" + }, + "timestamp": { + "name": "Total run time" + }, + "ssid": { + "name": "Wi-Fi SSID" + }, + "ip_addr": { + "name": "IP address" + } + }, + "switch": { + "v12_port_status": { + "name": "12V port status" + }, + "usb_port_status": { + "name": "USB port status" + }, + "ac_port_status": { + "name": "AC port status" + } + } } } diff --git a/homeassistant/components/goalzero/switch.py b/homeassistant/components/goalzero/switch.py index ac4872bba32..30680c6ff72 100644 --- a/homeassistant/components/goalzero/switch.py +++ b/homeassistant/components/goalzero/switch.py @@ -14,15 +14,15 @@ from .entity import GoalZeroEntity SWITCH_TYPES: tuple[SwitchEntityDescription, ...] = ( SwitchEntityDescription( key="v12PortStatus", - name="12V port status", + translation_key="v12_port_status", ), SwitchEntityDescription( key="usbPortStatus", - name="USB port status", + translation_key="usb_port_status", ), SwitchEntityDescription( key="acPortStatus", - name="AC port status", + translation_key="ac_port_status", ), ) diff --git a/tests/components/goalzero/test_sensor.py b/tests/components/goalzero/test_sensor.py index 90b1489803a..d36d692422e 100644 --- a/tests/components/goalzero/test_sensor.py +++ b/tests/components/goalzero/test_sensor.py @@ -33,41 +33,41 @@ async def test_sensors( """Test we get sensor data.""" await async_init_integration(hass, aioclient_mock) - state = hass.states.get(f"sensor.{DEFAULT_NAME}_watts_in") + state = hass.states.get(f"sensor.{DEFAULT_NAME}_power_in") assert state.state == "0.0" assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.POWER assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfPower.WATT assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT - state = hass.states.get(f"sensor.{DEFAULT_NAME}_amps_in") + state = hass.states.get(f"sensor.{DEFAULT_NAME}_current_in") assert state.state == "0.0" assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.CURRENT assert ( state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfElectricCurrent.AMPERE ) assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT - state = hass.states.get(f"sensor.{DEFAULT_NAME}_watts_out") + state = hass.states.get(f"sensor.{DEFAULT_NAME}_power_out") assert state.state == "50.5" assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.POWER assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfPower.WATT assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT - state = hass.states.get(f"sensor.{DEFAULT_NAME}_amps_out") + state = hass.states.get(f"sensor.{DEFAULT_NAME}_current_out") assert state.state == "2.1" assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.CURRENT assert ( state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfElectricCurrent.AMPERE ) assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT - state = hass.states.get(f"sensor.{DEFAULT_NAME}_wh_out") + state = hass.states.get(f"sensor.{DEFAULT_NAME}_energy_out") assert state.state == "5.23" assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENERGY assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfEnergy.WATT_HOUR assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.TOTAL_INCREASING - state = hass.states.get(f"sensor.{DEFAULT_NAME}_wh_stored") + state = hass.states.get(f"sensor.{DEFAULT_NAME}_energy_stored") assert state.state == "1330" assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENERGY assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfEnergy.WATT_HOUR assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.TOTAL - state = hass.states.get(f"sensor.{DEFAULT_NAME}_volts") + state = hass.states.get(f"sensor.{DEFAULT_NAME}_voltage") assert state.state == "12.0" assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.VOLTAGE assert (