We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
小爱同学语音控制总是返回 设备出问题,有时能正常控制,有时不行
设备出问题
环境:
Linux OptiPlex 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux Python 3.9.5 blinker-py 0.3.0
代码:
from blinker import Device from blinker.voice_assistant import VAType, VoiceAssistant, PowerMessage, DataMessage STATUS = 'off' async def power_change(message: PowerMessage): """ 电源状态改变(适用于灯和插座) """ global STATUS set_state = message.data["pState"] print(f"[{datetime.datetime.now()}] change power state to : {set_state}") if set_state == 'true': send_magic_packet(mac) STATUS = 'on' else: STATUS = 'off' await (await message.power(set_state)).update() async def state_query(message: DataMessage): print(f"[{datetime.datetime.now()}] query state: {message.data}") await (await message.power(STATUS)).update() device = Device("9701030d0719", websocket=True, mi_type=VAType.OUTLET) voice_assistant = VoiceAssistant(VAType.OUTLET) voice_assistant.state_query_callable = state_query voice_assistant.power_change_callable = power_change device.addVoiceAssistant(voice_assistant) if __name__ == '__main__': device.run()
日志
{'fromDevice': 'ServerSender', 'data': {'get': 'state', 'from': 'MIOT', 'messageId': '63778fa527969378'}} [2022-11-18 21:59:01.287934] query state: state 2022-11-18 21:59:01.288 | INFO | blinker.mqttclient:send_to_voiceassistant:115 - send mqtt message to voice assistant: {"fromDevice": "833128F89V2PBJ0TAIZXNYHL", "toDevice": "ServerReceiver", "data": {"pState": "false", "messageId": "63778fa527969378"}} 2022-11-18 21:59:02.377 | INFO | blinker.mqttclient:_on_connect:46 - Connect to broker from mqtt 2022-11-18 21:59:02.378 | SUCCESS | blinker.mqttclient:_on_connect:48 - Broker connected... {'fromDevice': 'ServerSender', 'data': {'set': {'pState': 'true', 'pstate': 'on'}, 'from': 'MIOT', 'messageId': '63778fa62842e056'}} [2022-11-18 21:59:02.436670] change power state to : true 2022-11-18 21:59:02.437 | INFO | blinker.mqttclient:send_to_voiceassistant:115 - send mqtt message to voice assistant: {"fromDevice": "833128F89V2PBJ0TAIZXNYHL", "toDevice": "ServerReceiver", "data": {"pState": "true", "messageId": "63778fa62842e056"}} 2022-11-18 21:59:03.482 | INFO | blinker.mqttclient:_on_connect:46 - Connect to broker from mqtt 2022-11-18 21:59:03.482 | SUCCESS | blinker.mqttclient:_on_connect:48 - Broker connected... {'fromDevice': 'ServerSender', 'data': {'get': 'state', 'from': 'MIOT', 'messageId': '63778fb12e9e096c'}} [2022-11-18 21:59:13.081066] query state: state 2022-11-18 21:59:13.081 | INFO | blinker.mqttclient:send_to_voiceassistant:115 - send mqtt message to voice assistant: {"fromDevice": "833128F89V2PBJ0TAIZXNYHL", "toDevice": "ServerReceiver", "data": {"pState": "true", "messageId": "63778fb12e9e096c"}} 2022-11-18 21:59:14.129 | INFO | blinker.mqttclient:_on_connect:46 - Connect to broker from mqtt 2022-11-18 21:59:14.129 | SUCCESS | blinker.mqttclient:_on_connect:48 - Broker connected...
The text was updated successfully, but these errors were encountered:
+1
Sorry, something went wrong.
刚试了,没问题啊
No branches or pull requests
小爱同学语音控制总是返回
设备出问题
,有时能正常控制,有时不行环境:
代码:
日志
The text was updated successfully, but these errors were encountered: