Giter Club home page Giter Club logo

Comments (11)

DanDixon avatar DanDixon commented on September 1, 2024

Also, I absolutely love this integration. Thanks again for all your help and for making and maintaining it.

from chime_tts.

nimroddolev avatar nimroddolev commented on September 1, 2024

Hey @DanDixon, thanks for the kind words πŸ‘

The chime_tts.say_url was added specifically to save the generated mp3 file in a publicly facing folder that is accessible form the internet. As you found out, you can change the default path to a local & non-public folder (but that defeats the purpose).

I tried editing the configuration, but that wasn't saving for me (a separate issue).

When you enter a folder path in the configuration, Chime TTS tests to see if it can write to that folder, and if it can't it returns an error. Is this the issue you're having when trying to change the configuration?
If you are not able to save a folder under the /www folder path, then it seems the issue here is that Chime TTS doesn't have access your www folder specifically.
Have you added a www folder to your config folder? See if adding the folder makes a difference.

Otherwise I will need more information. Could you please enable debug logs for Chime TTS? This way I might be able to understand what the issue is and how to solve it.

  1. Turn on debug logging:
service: logger.set_level
data:
  custom_components.chime_tts: debug
  1. Call the service chime_tts.say_url again (with the standard default folder path).

  2. Check your log messages in Home Assistant:

https://{YOUR_HOME_ASSISTANT_ADDRESS}:8123/config/logs?filter=chime_tts

and click LOAD FULL LOGS

from chime_tts.

DanDixon avatar DanDixon commented on September 1, 2024

When you enter a folder path in the configuration, Chime TTS tests to see if it can write to that folder, and if it can't it returns an error. Is this the issue you're having when trying to change the configuration?

It was flickering and giving me no error, but just reset the text back like it was.
I'm not sure what I did, but this is not happening to me now.

I was not getting this:
image

Which I am now, so not sure what happened.


As an asdie:
If you type something into Custom 1 and then try and delete it, it reverts back. Doesn't seem to be a way to reset those back to blank.
image


If you are not able to save a folder under the /www folder path, then it seems the issue here is that Chime TTS doesn't have access your www folder specifically.
Have you added a www folder to your config folder?

Yes


Unfortunately, I still wasn't able to get it to write to:
/config/www/chime_tts
(I made a folder there)

from chime_tts.

nimroddolev avatar nimroddolev commented on September 1, 2024

I still think the main issue is that your HA instance can't write to the folder you specified as the public folder for chime_tts.say_url. Perhaps it has to do with something in your particular setup? Which version of HA are you running and on what hardware?

Regarding the other issue you reported for custom chime paths:

Doesn't seem to be a way to reset those back to blank.

It's an issue with Home Assistant - if the textfield is blank it reverts to using previous value. A workaround is to you use a space " " as the value, which will reset the value. It's not the most elegant solution, but this bug is beyond the scope of Chime TTS. If you like you can open a bug with the Home Assistant developers.

from chime_tts.

DanDixon avatar DanDixon commented on September 1, 2024

The chime_tts.say_url was added specifically to save the generated mp3 file in a publicly facing folder that is accessible form the internet. As you found out, you can change the default path to a local & non-public folder (but that defeats the purpose).

Aside from my original question, I'll share why I'm using say url:

I have a popup that appears on my dashboards when a message is played. Being able to generate the sound file separately from playing it lets me wait to show the popup at the same time as the file is played (instead of showing the popup with the message and there being a several second delay before it starts playing).

Does that use case match your vision for the feature?


I setup a time poem to be read aloud every so often (inspired by this Kickstarter).

But these take about 7 seconds before they start playing. Another use of say_url (that I have yet to implement) would be to generate the files in advance (even 1 minute before) so when it was requested there would be less delay and it could start playing exactly at the start of the event in question.

Here's what my dashboard looks like with a time poem message:
image

from chime_tts.

nimroddolev avatar nimroddolev commented on September 1, 2024

I never considered your use case or any other which required delayed/scheduled playback of the audio generated by Chime TTS. The time poem is a nice idea πŸ˜€

I released a new beta, v0.13.1-beta13 (I'm aiming for a record number of beta releases πŸ€¦β€β™‚οΈ) which adds support for specifying a local folder path for chime_tts.say_url generated audio in addition to a public directory. With this change you can now set a local folder path as the public folder path in the configuration, and the url output from chime_tts.say_url will work for either scenario - adding the external URL prefix for files located inside the public www folder, or the valid config local path.

Let me know if it's working for you.

from chime_tts.

DanDixon avatar DanDixon commented on September 1, 2024

Cool. That works.

Although, I don't think I fully understand how the paths work in Home Assistant as I still had to modify the output url in order to make it work:

In v0.13.1-beta13:

In the configuration for chime_tts I set the folder path to:
/media/chime_tts/
image

Running chime_tts.say_url generates a chime_tts.url that looks like this:
/media/chime_tts/jx9x352u.mp3

And before playing the file to my Google minis I did this in the play script:

variables:
  mediafile: |
    {{ chime_tts.url | replace('/media/','media-source://media_source/local/') }}

The mediafile variable now looks like this:
media-source://media_source/local/chime_tts/jx9x352u.mp3

I was struggling because I had it like this and it didn't work:
media-source://media_source/local/media/chime_tts/jx9x352u.mp3

And then I play the file like this:

service: media_player.play_media
data:
  media_content_id: "{{ mediafile }}"
  media_content_type: music
target:
  entity_id:
    - media_player.minis_linked

Perhaps there's a more elegant solution. Either way, it works, so thank you again!

from chime_tts.

nimroddolev avatar nimroddolev commented on September 1, 2024

Perhaps the best solution would be for chime_tts.say_url to return both the local file path and the media_content_id (which is what you did with your script), eg:

media_content_id: media-source://media_source/local/media/chime_tts/f_21f4mz.mp3
filepath: /media/chime_tts/f_21f4mz.mp3
duration: 1.23
success: true

from chime_tts.

DanDixon avatar DanDixon commented on September 1, 2024

That would useful.

I'll note that your example media_content_id:
media-source://media_source/local/media/chime_tts/f_21f4mz.mp3

But, at least in my case it should be:
media-source://media_source/local/chime_tts/f_21f4mz.mp3

Thank you again!

from chime_tts.

DanDixon avatar DanDixon commented on September 1, 2024

Using v1.0.0 2024-04-02

I had to modify my scripts to work with the new changes and this is working great.
(I had to change them to use media_content_id instead of url)

Thank you!

from chime_tts.

nimroddolev avatar nimroddolev commented on September 1, 2024

Happy to hear it’s working for you πŸ‘

from chime_tts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.