FINALLY local voice assist (no llm)

PLEASE move this if it's deemed in the wrong place. shrug

I'm using the Gravity: DF2301Q Offline Voice Recognition Sensor. It has it's own speakers (you can add an external) and it's own microphone. This has somewhat fulfilled my needs although it has a limited amount of allowed command words. You can ONLY add 21 (I believe). The rest of the command words are bloat unless you want to use them or repurpose them. The custom wake up word (I used nemo) is somewhat useless as when the device has been idle after sometime I have to use the default wake word (hello robot). I'm running this on a esp32wroom the module is on i2c running on esphome and relaying via mqtt to hubitat. Works pretty efficiently. I had to make the mqtt clear so I can reuse commands. Example: kitchen just throws a number 5. If I trained it to learn kitchen off and kitchen on it would be 5 and 6 which minimizes the amount of usable commands. So I gave in and gave it a list of bulbs and have hubitat rm handle it from there. All in all this is pretty cool. I'm waiting on my esp32box3 to test this on next in hope of more command flexibility/expandability.

This is NOT a shill. I'm genuinely disgusted with alexa.

    • # =========================================================
      # ESP32 + DF2301Q VOICE MODULE
      # =========================================================
      
      esphome:
        name: esp32text
      
      esp32:
        board: esp32dev
        framework:
          type: esp-idf
      
      logger:
        level: DEBUG
      
      api:
      
      ota:
        - platform: esphome
      
      # =========================================================
      # I2C
      # =========================================================
      
      i2c:
        sda: GPIO21
        scl: GPIO22
        scan: true
        frequency: 100kHz
      
      # =========================================================
      # DF2301Q VOICE MODULE
      # =========================================================
      
      i2c_device:
        id: voice_module
        address: 0x64
      
      # =========================================================
      # NUMERIC VOICE STATUS
      #
      # 1 = Waiting
      # 2, 3, 4... = Voice command ID
      # =========================================================
      
      sensor:
        - platform: template
          name: "Voice Status"
          id: voice_status_sensor
          accuracy_decimals: 0
          update_interval: never
      
          lambda: |-
            return 1.0;
      
      # =========================================================
      # RETURN VOICE STATUS TO 1 AFTER COMMAND
      # =========================================================
      
      script:
        - id: voice_waiting
          mode: restart
          then:
            - delay: 500ms
      
            - sensor.template.publish:
                id: voice_status_sensor
                state: 1
      
            - lambda: |-
                ESP_LOGD(
                  "VOICE",
                  "VOICE STATUS: 1 (Waiting)"
                );
      
      # =========================================================
      # VOICE COMMAND POLLING
      # =========================================================
      
      interval:
        - interval: 250ms
          then:
            - lambda: |-
                uint8_t command_id = 0;
      
                auto err = id(voice_module).read_register(
                  0x02,
                  &command_id,
                  1
                );
      
                if (err == i2c::ERROR_OK && command_id != 0) {
      
                  ESP_LOGD(
                    "VOICE",
                    "COMMAND ID: %u",
                    command_id
                  );
      
                  // Publish the numeric voice command ID.
                  // Example:
                  // Command ID 2 -> Voice Status = 2
      
                  id(voice_status_sensor)->publish_state(
                    (float) command_id
                  );
      
                  ESP_LOGD(
                    "VOICE",
                    "VOICE STATUS: %u",
                    command_id
                  );
      
                  // Clear the DF2301Q command register.
      
                  uint8_t clear_id = 0;
      
                  id(voice_module).write_register(
                    0x02,
                    &clear_id,
                    1
                  );
      
                  // Return to "Waiting" after 500ms.
      
                  id(voice_waiting).execute();
                }
      

      If anyone has a better suggestion for achieving offline voice assist please chime in.

      I HAVE NO INTEREST IN HOME ASSISTANT

I changed the c6 protocol to a zigbee button and its 10x faster than bthome (vsc...bleh) and mqtt.

Unfortunately the esp32-s3-box-3 will have to be on mqtt as it does not support zigbee/thread like the c5 does. I've made some progress by adding my own command/phoneme.

in app_sr.c

{SR_CMD_KITCHEN_ON, SR_LANG_EN, 0, "Kitchen On", "KiTcn nN", {NULL}},

{SR_CMD_KITCHEN_OFF, SR_LANG_EN, 0, "Kitchen Off", "KiTcn eF", {NULL}},

The comparison:

Gravity: DF2301Q Offline Voice Recognition Sensor works with little to no code out of the box with LIMITED commands (17)

The esp32-s3-box-3 can store 200 commands and I believe the wake word can be customized.