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

How can i set port for home host? My primary host is cloudmqtt with 19400 port. And when i try connect in my local network connection is refused. My local mqtt broker listen on 1883 port.

Are you by any chance trying to authenticate with a client certificate or configured mosquitto to require client certificate authentication? Because this isn’t supported by Zanzito.
The error you reported from mosquitto seems related to the client (not) authenticating to the server, not the contrary (not Zanzito verifying the authenticity of the server’s certificate), but I might be wrong or it could be the byproduct of another problem.

The error in Zanzito might to be related to one of the following cases:

The CA that issued the server certificate was unknown
The server certificate wasn’t signed by a CA, but was self signed
The server configuration is missing an intermediate CA

Normally, the first two are solved by manually importing the CA certificate in Android: Zanzito doesn’t handle this, it’s a request to the system.

The third one could be of interest, it depends on how you generated the certificates, try googling a little bit. I don’t think it’s a problem in Zanzito because Zanzito actually doesn’t do anything with the certificates, it relies on the system.
Maybe Owntracks can overcome a possible problem by manually managing the certificates, but first we should understand what the problem is (this is the first time such an issue was signaled to me)

EDIT: I did some digging: by importing the CA certificate directly, Owntracks bypasses a few alerts (mainly, one of the three cases above) that instead Android issues. Even if yours is the only case so far, I added the implementation of a similar feature to my todo list, have patience.
In the meanwhile you could experiment by re-issuing your certificates with alternate methods: for example, I don’t know if you already tried the method sketched here.

In Zanzito, the port number is common to both hosts. I think you can easily setup a second listener in your local broker with the same port as your public one.

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?