mairas / hysen

Home-assistant support for Broadlink Hysen thermostat controllers
Apache License 2.0
30 stars 20 forks source link

depreciation warning of entity service with a non entity service schema #62

Open mamrai1 opened 4 days ago

mamrai1 commented 4 days ago

2024-10-30 23:17:35.071 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hysen' registers an entity service with a non entity service schema which will stop working in HA Core 2025.9 at custom_components/hysen/climate.py, line 527: hass.data[DOMAIN].async_register_entity_service(, please create a bug report at https://github.com/mairas/hysen/issues 2024-10-30 23:17:35.074 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hysen' registers an entity service with a non entity service schema which will stop working in HA Core 2025.9 at custom_components/hysen/climate.py, line 532: hass.data[DOMAIN].async_register_entity_service(, please create a bug report at https://github.com/mairas/hysen/issues 2024-10-30 23:17:35.076 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hysen' registers an entity service with a non entity service schema which will stop working in HA Core 2025.9 at custom_components/hysen/climate.py, line 537: hass.data[DOMAIN].async_register_entity_service(, please create a bug report at https://github.com/mairas/hysen/issues 2024-10-30 23:17:35.081 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hysen' registers an entity service with a non entity service schema which will stop working in HA Core 2025.9 at custom_components/hysen/climate.py, line 542: hass.data[DOMAIN].async_register_entity_service(, please create a bug report at https://github.com/mairas/hysen/issues

Joao-Sousa-71 commented 4 days ago

I've got the same I and believe that I was able to fix it. This is related with this change:

https://developers.home-assistant.io/blog/2024/08/27/entity-service-schema-validation/ https://developers.home-assistant.io/docs/dev_101_services/#entity-service-actions

Filé climate.py, Line 87, where it is:

SET_WIFI_SCHEMA = vol.Schema({
    vol.Optional(ATTR_ENTITY_ID,default="all"): cv.comp_entity_ids,
    vol.Required(CONF_WIFI_SSID): cv.string,
    vol.Required(CONF_WIFI_PASSWORD): cv.string,
    vol.Required(CONF_WIFI_SECTYPE): vol.Range(min=0, max=4),
    vol.Optional(CONF_WIFI_TIMEOUT,default=DEFAULT_TIMEOUT): vol.Range(min=0, max=99),
})

change to:

SET_WIFI_SCHEMA = {
    vol.Optional(ATTR_ENTITY_ID,default="all"): cv.comp_entity_ids,
    vol.Required(CONF_WIFI_SSID): cv.string,
    vol.Required(CONF_WIFI_PASSWORD): cv.string,
    vol.Required(CONF_WIFI_SECTYPE): vol.Range(min=0, max=4),
    vol.Optional(CONF_WIFI_TIMEOUT,default=DEFAULT_TIMEOUT): vol.Range(min=0, max=99),
}

Line 122, change this:

SET_ADVANCED_SCHEMA = vol.Schema({
    vol.Required(ATTR_ENTITY_ID): cv.comp_entity_ids,
    vol.Optional(CONFIG_ADVANCED_LOOPMODE,default=DEFAULT_LOOPMODE): vol.Range(min=0, max=2),
    vol.Optional(CONFIG_ADVANCED_SENSORMODE,default=DEFAULT_SENSORMODE): vol.Range(min=0, max=2),
    vol.Optional(CONFIG_ADVANCED_MINTEMP,default=DEFAULT_MINTEMP): vol.Range(min=5, max=99),
    vol.Optional(CONFIG_ADVANCED_MAXTEMP,default=DEFAULT_MAXTEMP): vol.Range(min=5, max=99),
    vol.Optional(CONFIG_ADVANCED_ROOMTEMPOFFSET,default=DEFAULT_ROOMTEMPOFFSET): vol.Coerce(float),
    vol.Optional(CONFIG_ADVANCED_ANTIFREEZE,default=DEFAULT_ANTIFREEZE): vol.Range(min=0, max=1),
    vol.Optional(CONFIG_ADVANCED_POWERONMEM,default=DEFAULT_POWERONMEM): vol.Range(min=0, max=1),
    vol.Optional(CONFIG_ADVANCED_EXTERNALSENSORTEMPRANGE,default=DEFAULT_EXTERNALSENSORTEMPRANGE): vol.Range(min=5, max=99),
    vol.Optional(CONFIG_ADVANCED_DEADZONESENSORTEMPRANGE,default=DEFAULT_DEADZONESENSORTEMPRANGE): vol.Range(min=1, max=99),
})

to:

SET_ADVANCED_SCHEMA = {
    vol.Required(ATTR_ENTITY_ID): cv.comp_entity_ids,
    vol.Optional(CONFIG_ADVANCED_LOOPMODE,default=DEFAULT_LOOPMODE): vol.Range(min=0, max=2),
    vol.Optional(CONFIG_ADVANCED_SENSORMODE,default=DEFAULT_SENSORMODE): vol.Range(min=0, max=2),
    vol.Optional(CONFIG_ADVANCED_MINTEMP,default=DEFAULT_MINTEMP): vol.Range(min=5, max=99),
    vol.Optional(CONFIG_ADVANCED_MAXTEMP,default=DEFAULT_MAXTEMP): vol.Range(min=5, max=99),
    vol.Optional(CONFIG_ADVANCED_ROOMTEMPOFFSET,default=DEFAULT_ROOMTEMPOFFSET): vol.Coerce(float),
    vol.Optional(CONFIG_ADVANCED_ANTIFREEZE,default=DEFAULT_ANTIFREEZE): vol.Range(min=0, max=1),
    vol.Optional(CONFIG_ADVANCED_POWERONMEM,default=DEFAULT_POWERONMEM): vol.Range(min=0, max=1),
    vol.Optional(CONFIG_ADVANCED_EXTERNALSENSORTEMPRANGE,default=DEFAULT_EXTERNALSENSORTEMPRANGE): vol.Range(min=5, max=99),
    vol.Optional(CONFIG_ADVANCED_DEADZONESENSORTEMPRANGE,default=DEFAULT_DEADZONESENSORTEMPRANGE): vol.Range(min=1, max=99),
}

then on line 138, where:

SET_REMOTELOCK_SCHEMA = vol.Schema({
    vol.Required(ATTR_ENTITY_ID): cv.comp_entity_ids,
    vol.Required(CONFIG_REMOTELOCK): vol.Range(min=0, max=1),
})

change to:

SET_REMOTELOCK_SCHEMA = {
    vol.Required(ATTR_ENTITY_ID): cv.comp_entity_ids,
    vol.Required(CONFIG_REMOTELOCK): vol.Range(min=0, max=1),
}

finally on line 161, change this:

SET_TIME_SCHEDULE_SCHEMA = vol.Schema({
    vol.Required(ATTR_ENTITY_ID): cv.comp_entity_ids,
    vol.Required(CONFIG_WEEK_PERIOD1_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD1_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEK_PERIOD2_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD2_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEK_PERIOD3_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD3_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEK_PERIOD4_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD4_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEK_PERIOD5_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD5_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEK_PERIOD6_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD6_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEKEND_PERIOD1_START): cv.time,
    vol.Required(CONFIG_WEEKEND_PERIOD1_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEKEND_PERIOD2_START): cv.time,
    vol.Required(CONFIG_WEEKEND_PERIOD2_TEMP): vol.Coerce(float),
})

to this:

SET_TIME_SCHEDULE_SCHEMA = {
    vol.Required(ATTR_ENTITY_ID): cv.comp_entity_ids,
    vol.Required(CONFIG_WEEK_PERIOD1_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD1_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEK_PERIOD2_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD2_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEK_PERIOD3_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD3_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEK_PERIOD4_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD4_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEK_PERIOD5_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD5_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEK_PERIOD6_START): cv.time,
    vol.Required(CONFIG_WEEK_PERIOD6_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEKEND_PERIOD1_START): cv.time,
    vol.Required(CONFIG_WEEKEND_PERIOD1_TEMP): vol.Coerce(float),
    vol.Required(CONFIG_WEEKEND_PERIOD2_START): cv.time,
    vol.Required(CONFIG_WEEKEND_PERIOD2_TEMP): vol.Coerce(float),
}

That't is. Please try it and test.

mamrai1 commented 4 days ago

Works! Thanks! I will make a pr