Thank you so much!!
For TLS and MQTT the post should be 8883 is it not?
Not necessarily. The actual port is configurable and for practical reasons I use 1883.
Thanks.
How do you do a simple
Turn on the living room light
?
I’m wondering can zanzito do voice recognition? I notice Google Now can do that. Perhaps Google allows developer to have this via some kind of API?
The reason why is I want to protect the automation so that only certain people can issue the command.
Another possible usage is everyone in the house can use the same command “Where is my phone?”. The activity topic in zanzito would be %devicename%/%user%/chitchat with %user% being the variable set in zanzito. Each user will his/her own voice print in zanzito.
But how you do, if you do, to turn on a light or a switch?
It is needed an automation for each event?
For example turn on a light, you need an automation that if mqtt change state from off to on then you turn on the light?
Or there is something simpler?
Right now, I have this in my zanzito…
Activity #1
Name: Balcony Light
Topic: %devicename%/switch/light/balcony
Payload: on
Voice cmd: turn on balcony light
Activity #2
Name: Balcony Light
Topic: %devicename%/switch/light/balcony
Payload: off
Voice cmd: turn off balcony light
…and this is in my HA automation:
- alias: 'MQTT Switch'
trigger:
platform: mqtt
topic: myphone/switch/#
action:
- service_template: >
homeassistant.turn_{{trigger.payload}}
data_template:
entity_id: >-
{{ trigger.topic.split('/')[-2] }}.{{ trigger.topic.split('/')[-1] }}
- service: mqtt.publish
data_template:
topic: >-
zanzito/{{ trigger.topic.split('/')[-4] }}/notification
payload: >-
{% set responses = [
"OK",
"Sure",
"If you insist",
"Done",
"Alright",
"No worries",
"I can do that",
"Leave it to me",
"Consider it done",
"As you wish",
"By your command",
"Affirmative",
"No Problem"
] %}
{% set rindex = (range(0, (responses | length - 1) )|random) -%}
{{responses[rindex]}}
As you can see, this is not the most ideal way to do it because for each switch/light/script that you want to control, you have to create 2 activities. If you have 50 items you want to control, you have to create 100 activities in total.
Right now, with the support of getting payload from vocal command, I am thinking of shrinking everything into one activity and one automation for every smart items in my house. Still work in progress. Faced some obstacles. Might need some advice here.
EDIT, now I understand, you need two activities in Zanzito for each device you want to control
I do not understand how to publish the topic of the light … sorry mqtt newb here …
I mean how you connect th state
light.balcony_light
with a topic?
base on my automation, your mqtt topic must follow the entity ID.
For example, if your entity ID is light.balcony_light
, then your topic must be %devicename%/switch/light/balcony_light
.
More example…
light.livingroom1 —> %devicename%/switch/light/livingroom1
group.room_lights—> %devicename%/switch/group/room_lights
switch.room_fan—> %devicename%/switch/switch/room_fan
The automation will split up the last 2 levels and use it to form the entity id
{{ trigger.topic.split('/')[-2] }}.{{ trigger.topic.split('/')[-1] }}
small bug,
in
activities
new topic
voice cmd,
it shows too few characters
IT WORKS.
Ahahah I can turn on my lights in Italian …
Turn ON and OFF works great (which is enough, but just curious how to change STATE ATTRIBUTES, like brightness, colour …
not sure if this is available or programmed. Is it possible to create home shortcuts? This way you could fire up activities with one touch from home screen (sort of HTTP Shortcut program)
@MrMep
Is it possible to give multiple commands for the same activity?
Like
- turn on light
- turn light on
- light on
all in same activity
?
would this work for script?
EDIT
YES, it does!
I suspect there could be some confusion about different certificates on your device: can you check if this is the case? AFAIK, Owntracks loads his own CA certificate from a path, while Zanzito relies on the device’s certificate repository: can you see in the settings if under “User” there’s more than one CA certificate? Maybe try to delete them and re-import?
Is your mosquitto updated to the latest version?
Thanks,
gl
EDIT: also, I know it’s working, but you should consider changing the port to 8883, as per IANA standard…
I will look into that but I’m afraid the user is recognized by the “Ok, Google” phrase and I can’t find any sign of API about that…
Another approach would be to use google now to send commands to Zanzito, but that looks a even more complicated to setup from a user’s perspective…
mmhh…
Yes, you can. For example I have one activity that responds to the voice cmd Radio
and it take the payload from the vocal command.
So, if I say “Radio on” it sends something like radio/command on
“Radio off” → radio/command off
“Radio up” → radio/command up
(for the volume)
etc…
then in HA I have a few automations like:
- alias: Play/pause on Remote
trigger:
- platform: mqtt
topic: radio/command
payload: 'on'
action:
- service: homeassistant.turn_on
entity_id: switch.radio_on_off
I guess it could be done better with a single script for all possibile commands, but I haven’t done that yet…
this I do not get it
I have the following example
topic phone/switch/group/livingroom_lights
Payload off
Voice cmd spegni luce soggiorno
Get payload from vocal command (checked).
And I use masterkenobi code
When there is something in the Payload field will overwrite the “Get payload from vocal command” option?