Announcing MQTT/Android bridging app: Zanzito. Beta testers wanted!

Thanks. :slight_smile:

1 Like

Did you tried connecting the speakerphone via USB?

I have Jabra 410 and it works. But still not as good as Alexa :sweat:

OK guys. I have finally found the best automation for the switch control. Here is what I did…

- alias: 'MQTT Switch'
  trigger:
    platform: mqtt
    topic: myphone/switch/#
  action:
    - service_template: >
        homeassistant.{{ trigger.topic.split('/')[-1] }}
      data_template:
        entity_id: >-
          {% set payload = trigger.payload %}

          {%- if payload == 'dining' -%}
            group.dining_lights_fan

          {%- elif payload == 'kitchen lights' or payload == 'kitchen light' -%}
            group.kitchen_lights

          {%- elif payload == 'play room' or payload == 'playroom' -%}
            group.playroom

          {%- elif payload == 'living room lights' -%}
            group.livingroom_lights

          {%- elif payload == 'everything' -%}
            group.all_items

          {%- elif payload == 'staircase lights' -%}
            group.staircase_1_lights

          {%- elif payload == 'bedroom lights' -%}
            group.masterbedroom_all_lights

          {%- elif payload == 'bedroom' -%}
            group.masterbedroom_all_switches

          {%- elif payload == 'upper staircase lights' -%}
            group.staircase_2_lights

          {%- elif payload == 'office fans' or payload == 'office fan' -%}
            group.office_all_fans

          {%- elif payload == 'office' -%}
            group.office_all_switches

          {%- endif %}
    - service: mqtt.publish
      data_template:
        topic: >-
          zanzito/{{ trigger.topic.split('/')[-3] }}/notification
        payload: >-
          {% set payload = trigger.payload %}
          {%- if 
            payload == 'dining' or
            payload == 'kitchen lights' or
            payload == 'kitchen light' or
            payload == 'play room' or
            payload == 'playroom' or
            payload == 'living room lights' or
            payload == 'everything' or
            payload == 'staircase lights' or
            payload == 'bedroom lights' or
            payload == 'bedroom' or
            payload == 'upper staircase lights' or
            payload == 'office fans' or
            payload == 'office fan' or
            payload == 'office'
          -%}
            {% 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]}}
          {%- else -%}
            "I'm sorry. I cannot find the device named {{payload}} in the house."
          {% endif %}

I have tested it and it works as expected. To add more switches/lights/groups, just add it in the action. As you can see, I have to duplicate the devices name at 2 places. But this is the best way I can come up with right now. It will feedback accordingly. If success, it will say “OK”. Otherwise, it will say “I’m sorry” with the device name it heard.

2 Likes

I’ve done some more testing.

First I’ve installed Zanzito on my tablet at home, just installing the ca.crt and setting up the connection details. Then it worked fine and I connected to my mosquitto without problems. This is an old Sony Tablet Z, running Android 5.0.2.

Then I went back to my phone and removed all installed certificates, installed only ca.crt. Uninstalled and reinstalled Zanzito from Play and reconfigured the connection. Same problem again with a certificate error. This a Samsung S7 Edge running Android 7.

So the problem is somehow with the phone.

Tried via USB, audio is fine, trying Google voice recognition it crashes, have no other program to check MIC (zanzito crashes landscape).

Why not as good?

It’s for true coders. Average users, as me, find Tasker complicated.
Depends the target you want to reach

So in order to recognize multiple natural language sentence you use multiple activity (for same action) and multiple elif?

Like
Turn on lights in living
Turn living on
Lights on in living

You do 3 activity (same topic) and 3 elif to say a successful response?

you can have multiple activities publish to the same topic which each activities have different “Voice cmd”.

But I doubt “Turn living on” will work because the payload (living) is in between the voice cmd words (turn on).

Mmhh now I am using your previous code.

With it the payload I keep only on or off. I assign multiple activity (with different voice command) to the same topic.

Like this I can program as many voice command variants I want, to the same topic-payload.

That is why I was asking the developer if he could put multiple voice command inside one single activity

@MrMep

I have a suggestion. Right now, Zanzito can trigger the phone alarm. Can it also change the phone DND (Do not disturb) mode on or off? I plan turn on the DND mode when I say “Goodnight​” and turn off the mode when I say “Good morning”.

Hi all,
a new version on Zanzito (0.9.8.1b) will be available in minutes on the Play store. What’s new:

  • Changed “Update location” in main menu to “Send report” (now it sends a complete heartbeat);
  • Added on demand heartbeat;
  • Added customizable negative vocal feedbacks to vocal commands;
  • Bug fixing.

In particular, if you enabled “On demand” under Preferences->MQTT connection, when Zanzito receives a message under the zanzito/<device-name>/sendheartbeat topic, it sends an heartbeat.

You can now customize the vocal negative feedback with your custom phrase of phrases: if you insert, in the corresponding preference field, multiple lines, they will be randomly chosen by Zanzito when it can’t found an activity corresponding to the vocal command you imparted.

Let me know
gl

I had thought of that. I wouldn’t want to rewrite Tasker tough :wink:

There are a few “Local Actions” we could think of:

  • Do not disturb On/off
  • Flashlight On/off
  • Reboot/Shutdown the device
  • Switch connectivity On/Off (Wifi, mobile, Bluetooth, etc)

Could you all please copy and paste this list adding your own suggestions?
The idea could be to have those actions triggered but custom topics, but I’m not promising anything :wink:
Or, alternatively, just go for a Tasker plugin…

Hooray! Thank you so much.

No. I don’t want to use Tasker. It’s too complicated for me.

1 Like

the Jabra works well with other application, is not working with Google Now (so also not with Zanzito) no matter what I do: either “Can’t open Microphone” or “Can’t reach Google server”

Can you elaborate on why you don’t like the setup? (Before I spend money on buying another android box, or an OTG cable for a spare smartphone android)

The mic accuracy range is still not as good as Alexa. It may not hear what you said accurately if you stand more than 3 meters away. That is in a quiet room.

I feel that in order to match the range Alexa is having, I need something like ReSpeaker or UMA-8 USB mic array. I also consider hacking my echo dots to turn it into a Bluetooth speakerphone that connects to my phone. Zanzito has a lot of potential, but it is currently limited by hardware limitation.

@MrMep

I notice that zanzito provides 5 possibilities of what it heard. if any of the guesses match the Voice cmd, it will trigger the activity. However, for “Get payload from vocal command”, it only sends the first guess in the list. This reduces the accuracy by 5 times. No wonder I notice it is harder to turn on/off my lights in my latest implementation. I have to speak very carefully for it understand me. Is this something that can be improve?

It actually sends the remainder of the same result where it found the voice cmd. I couldn’t come up with a better solution: the payload being anything, how could we choose one or the other, without a fixed reference?

Isn’t better a fixed payload (written) and multiple voice commands?

I doesn’t like it because it is too troublesome when you have a lot of items that you want to control. Imagine you 50 items. That means you have to create 100 activities in one device and then duplicate it to other devices. If you want to add more items, then you need re-duplicate it to other devices again.

With my second method, I just need to create the activity and never have to touch it again. If I want to add more items, I just do it in HA which is easier and faster to do compare to typing on the phone.

a backup/restore function can be done by the developer

@MrMep
Is it possible to backup/restore Activities and Reports?
Possibly sending the backup file on the cloud and/or email.

Plus the restore should be able to change the name of the device

True but is done one time, and is rock solid after you do it