- 积分
- 303
- 金钱
- 263
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
中级会员
- 积分
- 303
- 金钱
- 263
- HASS币
- 0
|
楼主 |
发表于 2024-7-3 19:18:06
|
显示全部楼层
感谢大佬关注帮助
有效正确ak = "TwvTSt10wfCiU8G8BFMZVK5mTQFxb6sX"
https://api.map.baidu.com/revers ... mp;location=39.9042,116.4074
浏览器能获取有效反馈
以下最简单py文件,亦错误。
import requests
import hass.states
url = "https://api.map.baidu.com/reverse_geocoding/v3/?ak=TwvTSt10wfCiU8G8BFMZVK5mTQFxb6sX&output=json&coordtype=wgs84ll&location=39.9042,116.4074"
response = requests.get(url)
hass.states.set('sensor.baidudizhi', response, {'friendly_name': '百度地址'})
错误码
日志记录器: homeassistant.components.python_script.ll123.py
来源: components/python_script/__init__.py:270
集成: Python Scripts (文档, 问题)
首次出现: 18:25:58 (1 次总计出现)
上次记录: 18:25:58
Error executing script
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 270, in execute
exec(compiled.code, restricted_globals) # noqa: S102
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ll123.py", line 1, in <module>
ImportError: __import__ not found
|
|