Repository: home-assistant/core
File: homeassistant/components/openevse/sensor.py (Python)

Code before:
        )
    )


async def async_setup_entry(
    hass: HomeAssistant,
    config_entry: ConfigEntry,
    async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
    """Add sensors for passed config_entry in HA."""
    async_add_entities(
        [
            OpenEVSESensor(config_entry.data[CONF_HOST], config_entry, description)
            for description in SENSOR_TYPES
        ]
    )


class OpenEVSESensor(SensorEntity):
    """Implementation of an OpenEVSE sensor."""

    def __init__(
        self, host: str, entry: ConfigEntry, description: SensorEntityDescription
    ) -> None:
        """Initialize the sensor."""
        self.unique_id = f"{host}: {description.key}"
        self.entity_description = description
        self.host = host
        self.entry = entry
        self.entity_registry_enabled_default = self.entity_description.key not in (
            "ir_temp",
            "rtc_temp",
        )

    def update(self) -> None:
        """Get the monitored data from the charger."""
        try:
            sensor_type = self.entity_description.key
            if sensor_type == "status":
                self._attr_native_value = self.entry.runtime_data.getStatus()
            elif sensor_type == "charge_time":
                self._attr_native_value = (
                    self.entry.runtime_data.getChargeTimeElapsed() / 60
                )
            elif sensor_type == "ambient_temp":
                self._attr_native_value = (
                    self.entry.runtime_data.getAmbientTemperature()
                )
            elif sensor_type == "ir_temp":
                self._attr_native_value = self.entry.runtime_data.getIRTemperature()
            elif sensor_type == "rtc_temp":

Review comment (suggestion):
I would recommend to check the import logic from `nederlandse_spoorwegen`. If we can't connect for whatever reason we should show a different issue

Code after:
            breaks_in_ha_version="2026.6.0",
            is_fixable=False,
            issue_domain=DOMAIN,
            severity=ir.IssueSeverity.WARNING,
            translation_key=f"deprecated_yaml_import_issue_{result.get('reason')}",
            translation_placeholders={
                "domain": DOMAIN,
                "integration_title": INTEGRATION_TITLE,
            },
        )
        return

    ir.async_create_issue(
        hass,
        HOMEASSISTANT_DOMAIN,
        "deprecated_yaml",
        breaks_in_ha_version="2026.7.0",
        is_fixable=False,
        issue_domain=DOMAIN,
        severity=ir.IssueSeverity.WARNING,
        translation_key="deprecated_yaml",
        translation_placeholders={
            "domain": DOMAIN,
            "integration_title": INTEGRATION_TITLE,
        },
    )


async def async_setup_entry(
    hass: HomeAssistant,
    config_entry: ConfigEntry,
    async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
    """Add sensors for passed config_entry in HA."""
    async_add_entities(
        (
            OpenEVSESensor(
                config_entry.data[CONF_HOST],
                config_entry.runtime_data,
                description,
            )
            for description in SENSOR_TYPES
        ),
        True,
    )


class OpenEVSESensor(SensorEntity):
    """Implementation of an OpenEVSE sensor."""

    def __init__(