Skip to content

Commit

Permalink
forward hotwordToggle to local mqtt for hotword program
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp2310 committed Apr 18, 2022
1 parent 74901d3 commit bdd25ac
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/server/MqttManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,25 @@ def topicPlayBytes(self, _client, _data, msg: mqtt.MQTTMessage):


def hotwordToggleOn(self, _client, _data, msg: mqtt.MQTTMessage):
"""
detect hotwordToggleOn on main mqtt and relay it for hotword process to localMqtt
broadcast to main components in same process as well
:param _client:
:param _data:
:param msg:
:return:
"""
if not self.isForMe(msg):
return

self._mqttLocalClient.loop_start()
self.localPublish(topic=msg.topic, payload=msg.payload)
self.broadcast(method=constants.EVENT_HOTWORD_TOGGLE_ON, exceptions=[self.name], propagateToSkills=True)


def hotwordToggleOff(self, _client, _data, msg: mqtt.MQTTMessage):
if not self.isForMe(msg):
return

self.localPublish(topic=msg.topic, payload=msg.payload)
self.broadcast(method=constants.EVENT_HOTWORD_TOGGLE_OFF, exceptions=[self.name], propagateToSkills=True)


Expand All @@ -308,7 +316,6 @@ def onHotwordDetected(self, _client, _data, msg):
:param msg:
:return:
"""
self._mqttLocalClient.loop_stop()
payload = self.Commons.payload(msg)

user = constants.UNKNOWN_USER
Expand Down

0 comments on commit bdd25ac

Please sign in to comment.