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

Web installer for snapcast #72

Open
anabolyc opened this issue Apr 23, 2024 · 43 comments
Open

Web installer for snapcast #72

anabolyc opened this issue Apr 23, 2024 · 43 comments

Comments

@anabolyc
Copy link

Hey folks.

I'm a developer of a few audio boards that work with snapclient, including Louder-esp32 and Esparagus set of boards. I'm currently testing them together with the Home Assistant. It really works great, sync is beyond belief.

I went a little further and made a web-flasher that will have pre-built configurations for all my boards that support snapclient (since the build process is not for faint-hearted).

The fundamental problem that I have is that WiFi credentials are baked into binary and there is no way I can provide a web-flasher to anyone else to use since it will never work in their wifi network. Ideally, I'd like to have improv-wifi integrated, for web-installer would handle wifi credentials right after firmware flashing. Documentation is very poor though, the only signal that it is possible is that ESPHome made it work somehow.

I wonder if you guys think about this issue and perhaps have a direction you'd like to go to solve it.

My work-in-progress branch is here

@CarlosDerSeher
Copy link
Owner

CarlosDerSeher commented Apr 23, 2024

@anabolyc without looking to much at your provided links I'd suggest using WiFi Provisioning maybe? This is already implemented through WiFi but could be extended to use the serial console as an input too. So after flashing the FW you could set the credentials from your web installer through the serial connection too?

@CarlosDerSeher
Copy link
Owner

Also beware of the very soon coming upgrade of master to IDF v5

@DerPicknicker
Copy link

@CarlosDerSeher .. Could you build the WiFi provisioning with the latest branch as I remember the building failed due wrong partition config. Could you please build it and verify that it works?

I tried that some time ago and if I remember correctly I wasn't able to build it.

I like those webinstaller because you can setup WiFi also directly in the browser. So would be Cool if this can be integrated into the current code.

For board from @anabolyc and the boards from espressif it would reduce the amount of time drastically. Just install it with your browser and set it up.

@CarlosDerSeher
Copy link
Owner

I didn't try recently but thanks for the pointer

@DerPicknicker
Copy link

DerPicknicker commented Apr 25, 2024

@CarlosDerSeher ..
See here: #74
@anabolyc .. Easiest way is to build the firmware with the wifi-provisioning to make it easy to change wifi.

@CarlosDerSeher
Copy link
Owner

@DerPicknicker please open an seperate issue with the relevant Information from here.

@DerPicknicker
Copy link

@CarlosDerSeher I will do it. Only for Bootloader or for both?

@CarlosDerSeher
Copy link
Owner

bootloader.

What happens if wifi connection is not possible - will the wifi provisioning start again? This would be a good way to changing the wifi without re-flashing the board.

This should be a feature request possibly?

See this https://github.com/jnthas/Improv-WiFi-Library this would allow to add the Wifi-Credentials directly in the browser. I see here some benefit. You're not relying on the APP from Espressif.

Is there a C library for this too?

@CarlosDerSeher
Copy link
Owner

CarlosDerSeher commented Apr 25, 2024

@anabolyc What do you think about providing the credentials through the serial interface? Wouldn't that be more convenient to the user? Also have a look here #75

@anabolyc
Copy link
Author

@anabolyc What do you think about providing the credentials through the serial interface? Wouldn't that be more convenient to the user? Also have a look here #75

@CarlosDerSeher I need to look into WiFi Provisioning, not sure how it integrates into esp-web-tools. The beauty of the improv-wifi is that it is just another step in flashing firmware with esp-web-tools, with wifi-scanning and everything in a single UI. If Wifi provisioning works the same, I'd prefer it, since it comes from the Espressif.

See this https://github.com/jnthas/Improv-WiFi-Library this would allow to add the Wifi-Credentials directly in the browser. I see here some benefit. You're not relying on the APP from Espressif.

Is there a C library for this too?

I think that's all she wrote, however, folks at ESPhome managed to wrap it up into espidf C component

@CarlosDerSeher
Copy link
Owner

esp_prov could be of interest for this. a python util implementing the protocol.

@anabolyc
Copy link
Author

anabolyc commented May 9, 2024

Continuing discussion from here

I see the config for the LyraT board (it si the same for the mini version?). I guess I'll remove wifi credentials in favor of wifi provisioning, also PSRAM should be enabled I guess.

@CarlosDerSeher Any other boards/configs you'd like to include?

@CarlosDerSeher
Copy link
Owner

I didn't test all of them but all those ADF boards (in sample stuffing branch) compile so maybe those?! I'll check my custom design using adau1961 dac, this too maybe

@DerPicknicker
Copy link

Hi @anabolyc ,

I added in the menuconfig the option to invert the logic-Levels. I think for the Louder it would be good if we have those options:

  • Stereo-Mode
  • Bridge-Mode (playing left channel)
  • Bridge-Mode-Invert (playing right channel)

I added only one SDKCONFIG but this is an easy way to create an completely wireless stereo setup with more power output.

@anabolyc
Copy link
Author

Hey folks. I've added common Espressif boards and AI-Thinker as well. The result is in the branch still, please have a look before I create a pull request: https://sonocotta.github.io/esparagus-snapclient/
If you can, please test with your boards to confirm the build.

  • Stereo-Mode
  • Bridge-Mode (playing left channel)
  • Bridge-Mode-Invert (playing right channel)

I would leave that to more experienced developers to do manually. All the possible configurations would overload the installer too much

@DerPicknicker
Copy link

DerPicknicker commented May 14, 2024

Great!!! that's awesome.

How is the general process looking? @CarlosDerSeher will merge the sync with sample stuff and the WiFi improv.

What is needed to get fresh binary's for those boards?

Edit: please try the softvolume if not already enabled for the HiFi version. That should allow controlling the volume even without hardware control.

@anabolyc
Copy link
Author

Edit: please try the softvolume if not already enabled for the HiFi version. That should allow controlling the volume even without hardware control.

Where I can enable that?

@DerPicknicker
Copy link

Where I can enable that?

Should be inside the DSP section .. If I remember correctly.

@anabolyc
Copy link
Author

I added short usage instructions

@DerPicknicker
Copy link

@anabolyc did you found the option?

@anabolyc
Copy link
Author

@anabolyc did you found the option?

Yes, enabled and flashed. It works fine, but did I miss it before? seems to be working exactly the same way.

@DerPicknicker
Copy link

So volume control works fine?

@CarlosDerSeher could you give us here some details?

@CarlosDerSeher
Copy link
Owner

Which DAC we are talking about?

@DerPicknicker
Copy link

PCM5100A from this device: see here

@anabolyc
Copy link
Author

So volume control works fine?

@CarlosDerSeher could you give us here some details?

Yes, I can change the volume from Music Assistant. Also, equilizer works
image

@CarlosDerSeher
Copy link
Owner

So this hasn't hardware volume control and soft volume isn't working as expected? Did I get this right?

@DerPicknicker
Copy link

DerPicknicker commented May 14, 2024

@anabolyc said that softvolume was working already without the option enabled in DSP settings that's why I asked if you @CarlosDerSeher could give us some more deteails...

@anabolyc while this works fine now I am even more thinking about getting one for my remaining speakers ;-)

Edit: @anabolyc .. So on which branch are you build the binary's on the master? Or on the sample syncing stuffing? Because Improv WiFi is not available as far as I know inside master or sync with sample stuffing.

@CarlosDerSeher
Copy link
Owner

Shouldn't work without soft volume enabled. At least not when using snapserver volume control. Maybe Music Assistant applies software volme control too? You should see this in the logs though.

@anabolyc
Copy link
Author

anabolyc commented May 14, 2024

When I change tho volume in MA, i see this on logs

I (9249) PLAYER: initial sync age: 9us, chunk duration: 24000us
I (12803) SC: Buffer length: 1000
I (12803) SC: Latency: 0
I (12803) SC: Mute: 0
I (12803) SC: Setting volume: 44
I (12807) dspProc: Set volume to 0.440000
I (16076) SC: Buffer length: 1000
I (16077) SC: Latency: 0
I (16077) SC: Mute: 0
I (16077) SC: Setting volume: 52
I (16081) dspProc: Set volume to 0.520000
I (16435) SC: Buffer length: 1000
I (16435) SC: Latency: 0
I (16435) SC: Mute: 0
I (16435) SC: Setting volume: 54
I (16439) dspProc: Set volume to 0.540000

Maybe it wasn't working before, now I'm not so sure :)

@CarlosDerSeher
Copy link
Owner

Try disabling it again and you'll know for sure :)

@anabolyc
Copy link
Author

You're right, when disabled it logs changes but doesn't actually change the volume

I (6522) PLAYER: initial sync age: 8us, chunk duration: 24000us
I (7995) SC: Buffer length:  1000
I (7995) SC: Latency:        0
I (7995) SC: Mute:           0
I (7995) SC: Setting volume: 24
I (9750) SC: Buffer length:  1000
I (9750) SC: Latency:        0
I (9750) SC: Mute:           0
I (9750) SC: Setting volume: 96
I (12070) SC: Buffer length:  1000
I (12070) SC: Latency:        0
I (12070) SC: Mute:           0
I (12071) SC: Setting volume: 12
I (13267) SC: Buffer length:  1000
I (13268) SC: Latency:        0
I (13268) SC: Mute:           0
I (13268) SC: Setting volume: 26
I (14115) SC: Buffer length:  1000
I (14115) SC: Latency:        0
I (14115) SC: Mute:           0
I (14116) SC: Setting volume: 44
I (14909) SC: Buffer length:  1000
I (14909) SC: Latency:        0
I (14909) SC: Mute:           0
I (14910) SC: Setting volume: 16
I (15380) SC: Buffer length:  1000
I (15381) SC: Latency:        0
I (15381) SC: Mute:           0
I (15381) SC: Setting volume: 10

Does I hook up to the hardware volume control on the TAS5805M DAC?

@DerPicknicker
Copy link

DerPicknicker commented May 14, 2024

@anabolyc .. TAS5805M works fine. Tested here. It's hardware .

Please update the sdkconfig as well :-)

@anabolyc
Copy link
Author

I've merged the installer to my master. Please feel free to pull the code upstream

@CarlosDerSeher
Copy link
Owner

This will take some time as I am traveling this week.

@CarlosDerSeher
Copy link
Owner

Also I saw you based this on current master. After merging "sync with sample stuffing" probably some changes will be required from your side.

@anabolyc
Copy link
Author

That's all right, just let me know when it will be merged

@CarlosDerSeher
Copy link
Owner

@anabolyc totaly forgot about it. All merged now. So you can test with master and see if everything still works. Please open a pull request when you are finished

@anabolyc
Copy link
Author

anabolyc commented Jun 14, 2024

Hey @CarlosDerSeher thanks for letting me know.

I pulled the latest changes from master, my build bootlooping when ethernet is enabled. I will disable it for now, but maybe you know what did I miss in config

image

UPD. seems to stopped bootlooping with this config

image

@CarlosDerSeher
Copy link
Owner

So all good then? Wrong defaults?

@anabolyc
Copy link
Author

So all good then? Wrong defaults?

Not entirely. With ethernet enabled, wifi-improv is not triggering, I cannot setup Wifi. Is this by design?

@CarlosDerSeher
Copy link
Owner

Ethernet and wifi will not work together. Hopefully this will change in future releases.
I designed improv for wifi so maybe it won't work with ethernet

@anabolyc
Copy link
Author

@CarlosDerSeher I've merged the master to my fork with web-installer, and tested with Esparagus boards. I don't think it makes sense to do PR back to your master, there are hundreds of build errors. It would be simpler to copy over installer files or leave alone installer in my fork.

@oliv3r
Copy link

oliv3r commented Jul 22, 2024

As I mentioned in #92 using ESPhome as a basis, would offer us a lot of these things out of the box :) EVEN when not connecting to home-assistant ... (you can leave out the api: but from the yaml definition to not even talk to home-assistant).

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

No branches or pull requests

4 participants