Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional 2nd package to add radar and battery sensors to esp32-s3-box-3.yaml #165

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

jaymunro
Copy link

@jaymunro jaymunro commented Feb 22, 2024

To be added as an extra package in addition to the main esp32-s3-box-3.yaml, e.g.

packages:
  esphome.voice-assistant: github://esphome/firmware/wake-word-voice-assistant/esp32-s3-box-3.yaml
  esphome.voice-assistant-sensor: github://jaymunro/esphome_firmware/wake-word-voice-assistant/esp32-s3-box-3-sensor.yaml@sensor_dock

All additions only use GPIO pins. I2C bus is not touched so it is very low resource usage.

Provides

Sensors:

  • battery voltage (hidden)
  • battery level %

Binary Sensor:

  • Presence detect (occupancy)

Number:

  • Presence duration (timeout to keep Presence detect true, default 60 seconds)

Switch:

  • Mute when absent (microphone and backlight off for low power)

To be added as an extra package in addition to the main esp32-s3-box-3.yaml

Provides
---------

Sensors:
 - battery voltage (hidden)
 - battery level %

Binary Sensor:
 - Presence detect (occupancy)

Number:
 - Presence duration (timeout to keep Presence detect true, default 300 seconds)

Switch:
 - Mute when absent (microphone and backlight off for low power)
@jaymunro jaymunro marked this pull request as draft February 22, 2024 04:10
@jesserockz
Copy link
Member

I like this.

I think we should move it out of this folder though as it can just be used generically for any s3-box-3 and doesn't need to be for voice-assistants.

Jesse

@jaymunro
Copy link
Author

I and others have had this running for several weeks now with some battery calibration performed from 2 separate users.
See https://community.home-assistant.io/t/esp32-s3-box3/638287/146.

I think having it as a package will make it an easy optional addition for those using the sensor dock.
Not sure on the best location for it though.

@jaymunro
Copy link
Author

I like this.

I think we should move it out of this folder though as it can just be used generically for any s3-box-3 and doesn't need to be for voice-assistants.

Ah ok. I'll move it to the voice-assistant folder then...

@jaymunro
Copy link
Author

Development recorded here:
esphome/feature-requests#2475 (comment)

@jaymunro
Copy link
Author

Screenshot of the device with the additional sensors and configuration options
Screenshot 2024-02-22 at 5 40 13 PM

@jaymunro
Copy link
Author

jaymunro commented Feb 22, 2024

Presently testing the compile with the yaml:

substitutions:
  name: esp32-s3-box-3-5ad0fc
  friendly_name: Jarvis
  micro_wake_word_model: hey_jarvis
packages:
  esphome.voice-assistant: github://esphome/firmware/wake-word-voice-assistant/esp32-s3-box-3.yaml
  esphome.voice-assistant-sensor: github://jaymunro/esphome_firmware/voice-assistant/esp32-s3-box-3-sensor.yaml@sensor_dock
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: xxxxxxxxxxxxxxxxxxxxxx=

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

@jaymunro
Copy link
Author

Looking at your comment again @jesserockz, I think battery and radar stuff can be pulled out to an even more generic location (where?), but the Mute when absent is specific to voice-assistants.

Where ever the others are moved to, the Mute when absent should either be kept with the voice-assistants or there would need to be some method to automatically only include that toggle if voice-assistant is present. Is there a best practice for doing this?

@jesserockz
Copy link
Member

Ah yes good point.

I think all the actual sensors could go in one file and mute on a sense could just be documented somewhere that people can add to their adopted yaml even alongside the package line they are already adding

@jaymunro
Copy link
Author

I've been looking through the file structure and it seems the only location for box3 firmware is inside the voice-assistant folders. As these sensors only work with the sensor version of the dock on the box3 (not even the gen1 box), then there would need to be yet another esp32-s3-box3 folder that is not VA related.

TLDNR: Presently there is no generic location that I can see. Is there presently a non VA use for the Box3 with sensor dock in ESPHome?

@jaymunro
Copy link
Author

Perhaps, what could be done is the basic functionality could be modified to be a stand-alone package and go into esp-web-tools as esp32s3box3sensor. Is this what you had in mind @jesserockz?

How then could this be made obvious to people setting up a box3 with sensor dock as a VA? Can an alias/link/shortcut to that file be put in the voice-assistant folder? Probably not best though imo as additions to it in the future that would work stand alone without VA, may conflict with VA. I am thinking of the i2c bus for temp and humidity as a very good example (there is a serious conflict with VA).

The resolution then may be just to have two versions, one in web tools, the other in voice-assistant (and maybe another in wake-word-voice-assistant?? So that people going for the micro wake word know that the sensor dock components will be compatible).

I am adding lines at the start to make it stand alone for web tools. I can also add the i2c bus with temp & humidity to it as they work and without VA present, VA will not self destruct.

Thoughts?

update name and friendly_name substitutions to add `Sensor`
@jaymunro
Copy link
Author

jaymunro commented Feb 22, 2024

My further thoughts are that although adding a generic firmware for the box3 sensor dock could be useful for someone, I actually put the package together for VA based on a number of forum comments requesting the radar sensor so the box:

  • can be carried around as a portable VA and people have an idea when the battery is about to go out.
  • goes offline and stops listening/streaming when no-one is in the room (the screen is too bright at night).
  • when on battery the VA consumes much less power when no-one is in the room.

Can we think about adding it as it is so that people waiting for it can use it now? The addition to web-tools sounds like a whole new project as there are people wanting to add TH and screen interaction that conflicts with VA.

Generic template to give battery level and radar on the sensor dock of the box 3
Add comments on purpose and use
added clarification that it is for the radar and battery in the sensor dock.
@jaymunro
Copy link
Author

I'm unclear as to what the difference/purpose of the esp-web-tools folder vs. the esphome-web, so I have added the sensors as a separate generic yaml in esp-web-tools.

I have also added comments to the voice-assistant version in the voice-assistant folder on how to use it and it's purpose.

@jaymunro jaymunro marked this pull request as ready for review February 24, 2024 03:48
@jaymunro jaymunro changed the title Create esp32-s3-box-3-sensor.yaml Optional 2nd package to add radar and battery sensors to esp32-s3-box-3.yaml Feb 24, 2024
@balloob
Copy link
Member

balloob commented Feb 24, 2024

I would suggest that we create a new firmware folder. Each folder has a purpose and we don't want to mix it up.

@jaymunro
Copy link
Author

I would suggest that we create a new firmware folder. Each folder has a purpose and we don't want to mix it up.

Can you clarify Paulus? Do you mean for the generic firmware or the voice-assistant specific one? Or are you suggesting putting both in a folder like box3-docks?

@jaymunro
Copy link
Author

@balloob @jesserockz , I have created a new folder esp32-box-docks that could be used for all the Espressif box docks and their various uses.
I've populated it with 2 yaml files:

  1. a generic version for the Box3 Sensor dock (battery level & radar for presence/absence)
  2. a voice-assistant version for the Box3 Sensor dock (battery & radar with mute on absence option)

If that makes better sense, it should be ready to go.

Change battery level % to whole numbers only to reduce recorder usage.
comment indentation
esp32-box-docks/box3-sensor-generic.yaml Outdated Show resolved Hide resolved
esp32-box-docks/box3-sensor-generic.yaml Outdated Show resolved Hide resolved
esp32-box-docks/box3-sensor-generic.yaml Outdated Show resolved Hide resolved
esp32-box-docks/box3-sensor-generic.yaml Outdated Show resolved Hide resolved
@esphome
Copy link

esphome bot commented Feb 26, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@esphome esphome bot marked this pull request as draft February 26, 2024 18:19
Suggestions committed
@jaymunro jaymunro marked this pull request as ready for review February 26, 2024 21:22
@esphome esphome bot requested a review from jesserockz February 26, 2024 21:22
@jaymunro
Copy link
Author

jaymunro commented Mar 2, 2024

@jesserockz, did my last changes meet what you were asking for?

publish initial state of radar on start up to counter the device starting up muted.
@joelis10
Copy link

Hey @jaymunro - I'm trying out your custom YAML and so far so good with everything except the battery sensors, I get
collect2: error: ld returned 1 exit status
*** [.pioenvs/esp32-s3-box-3-5a92ac/firmware.elf] Error 1
when trying to compile with those sensors added. Commenting them out allows it to compile again but I recently got a battery and would love it to appear in HA too. Any idea what the issue could be?

@adrianipopescu
Copy link

Any chances we could get this fixed and merged soon?

@adrianipopescu
Copy link

adrianipopescu commented Nov 6, 2024

thanks man.

silly question, since this morphed into a one-stop-shop extra yaml for the dock, does it make sense to include the temp & humidity sensors from esphome/feature-requests#2472 as well?

no idea on the ir transmitter/receiver functionality and how to interact with it, but this is more-than-enough-for-now for a casual user to get a lot of mileage from their devices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants