cnk700i / havcs

Home Assistant Voice Control Skill
https://ljr.im/articles/plugins-havcs-edible-instructions/
Apache License 2.0
311 stars 97 forks source link

Detected use of deprecated `base_url` property #29

Closed xia0linz1 closed 4 years ago

xia0linz1 commented 4 years ago

HA 版本 111.2,日志报错:Detected use of deprecated base_url property

Logger: homeassistant.components.http
Source: components/http/__init__.py:180
Integration: HTTP (documentation, issues)
First occurred: 上午10:30:04 (3 occurrences)
Last logged: 上午10:30:04

Detected use of deprecated `base_url` property, use `homeassistant.helpers.network.get_url` method instead. Please report issue to the custom component author for havcs using this method at custom_components/havcs/__init__.py, line 250: http_manager = hass.data[DOMAIN][DATA_HAVCS_HTTP_MANAGER] = HavcsHttpManager(hass, conf.get(CONF_HTTP, {}).get(CONF_HA_URL, hass.config.api.base_url), DEVICE_CONFIG_SCHEMA)
Detected use of deprecated `base_url` property, use `homeassistant.helpers.network.get_url` method instead. Please report issue to the custom component author for havcs using this method at custom_components/havcs/__init__.py, line 306: ha_url = conf.get(CONF_HTTP, {}).get(CONF_HA_URL, hass.config.api.base_url)
Detected use of deprecated `base_url` property, use `homeassistant.helpers.network.get_url` method instead. Please report issue to the custom component author for havcs using this method at custom_components/havcs/__init__.py, line 307: _LOGGER.debug("[init] ha_url = %s, base_url = %s", ha_url, hass.config.api.base_url)

havcs 的yaml里面,ha_url按照升级111.2以前设置为 https://localhost:8123, 目前不能正常使用,web界面点开套娃,不知道是不是这个原因造成的

dscao commented 4 years ago

这个提示目前不影响使用,如果要消除提示及适应hass后续新版本可能带来的问题,修改如下:

文件 init.py

上方加入 from homeassistant.helpers.network import get_url

内部共三处: hass.config.api.base_url 换成 get_url(hass)

如250行改为: http_manager = hass.data[DOMAIN][DATA_HAVCS_HTTP_MANAGER] = HavcsHttpManager(hass, conf.get(CONF_HTTP, {}).get(CONF_HA_URL, get_url(hass)), DEVICE_CONFIG_SCHEMA)

cnk700i commented 4 years ago

楼上正解,迟些会更新代码。套娃问题解决方法见这个issue。https://github.com/cnk700i/havcs/issues/30#issuecomment-683538573