在HA里使用的QQ邮箱通知
# 配置后生成【ha_qqmail.notify】服务
ha_qqmail:
qq: QQ号码
code: QQ邮箱授权码
调用服务格式
title: 标题
message: 消息内容
data:
url: https://github.com/shaonianzhentan/ha_qqmail
image: https://vuejs.org/images/logo.png
actions:
- action: close_light
title: 关灯
- action: close_all
title: 关掉全部灯
获取点击事件(参考链接:https://www.home-assistant.io/integrations/html5/)
- alias: 这是一个H5的通知提示
trigger:
platform: event
event_type: html5_notification.clicked
event_data:
action: close_light
vecany 发表于 2020-1-5 23:37
楼主,那个action的功能是不是不能用了啊,我用内网穿透完不成功啊?
2020-03-14 11:36:24 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2511835632] local variable 'msg' referenced before assignment
Traceback (most recent call last):
File "/usr/local/python3/lib/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service
connection.context(msg),
File "/usr/local/python3/lib/python3.6/site-packages/homeassistant/core.py", line 1235, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/local/python3/lib/python3.6/asyncio/futures.py", line 331, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/local/python3/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
future.result()
File "/usr/local/python3/lib/python3.6/asyncio/futures.py", line 244, in result
raise self._exception
File "/usr/local/python3/lib/python3.6/asyncio/tasks.py", line 181, in _step
result = coro.throw(exc)
File "/usr/local/python3/lib/python3.6/site-packages/homeassistant/core.py", line 1262, in _execute_service
await self._hass.async_add_executor_job(handler.func, service_call)
File "/usr/local/python3/lib/python3.6/asyncio/futures.py", line 331, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/local/python3/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
future.result()
File "/usr/local/python3/lib/python3.6/asyncio/futures.py", line 244, in result
raise self._exception
File "/usr/local/python3/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ha_qqmail/__init__.py", line 95, in notify
_message = self.api_msg.default(_message, _entity, _action, hass.config.api.base_url.strip('/') + URL)
File "/config/custom_components/ha_qqmail/api_msg.py", line 23, in default
if entity is None and action is None:
UnboundLocalError: local variable 'msg' referenced before assignment
coriding 发表于 2020-3-14 11:40
2020-03-14 11:36:24 ERROR (MainThread) [homeassistant.components.websocket_api.http.connect ..
自己读了一下api_msg.py
发现,其中使用了msg
但是参数传递却不是使用该参数,而是应该使用title
因此将楼主代码修改了一点点
将api_msg.py
中的所有
return self.template(msg)
#替换为下面的内容
return self.template(title)
coriding 发表于 2020-3-14 12:00
[md]
自己读了一下`api_msg.py`发现,其中使用了`msg` 但是参数传递却不是使用该参数,而是应该使用`titl ...
karl_31 发表于 2019-11-24 17:25
学习一下,谢谢分享
欢迎光临 『瀚思彼岸』» 智能家居技术论坛 (https://bbs.hassbian.com/) | Powered by Discuz! X3.5 |