kamaradclimber / radio-france-home-assistant

An integration of Radio France API into Home-Assistant
Apache License 2.0
4 stars 0 forks source link

Support FIP #1

Open kamaradclimber opened 10 months ago

kamaradclimber commented 10 months ago

FIP is a special case because it contains "tracks" only AND does not publish the program in advance.

It leads to errors to find the current program and out-dated data until the next refresh against the api.

In practice what happens:

Solutions:

kamaradclimber commented 10 months ago

Note: I've sent an email to the radio france api support to see if they have advice.

Nikohomeassistant commented 10 months ago

Hey Sorry in advance if my remarks make no sense but i have no idea about building integrations, so just take it as user's wish plz :) If you got the tracks available in the API, can't you create a sensor just for the track ? we know the current track (and past tracks) and can display it I dont see that. Also, as a track is most of the time more than 2 minutes long, cant you imagine refreshing it every 60sec ? I understand it would create an error after 16h/day listenning but who does that ? :) Finally, i guess the radio france logo would make the integration much smarter ;) I'm aware you just brought that up quickly, great job ! Even if you're the man, i'm happy enough having brought the idea to you ;) Good luck with that !

Nikohomeassistant commented 10 months ago

Me, again! I was also wondering if its easy to change the fact we need to enter API for each radio we add. Talking about that, i miss the few FIP webradios such as FIP groove or FIP reggae :) Sorry i wish i could do it myself ! I tried and check and its way above my level !

kamaradclimber commented 10 months ago

If you got the tracks available in the API, can't you create a sensor just for the track ?

This is what is supposed to exist. There are two entities exposed by the integration:

we know the current track (and past tracks) and can display it I dont see that. Then what do you see ? Please share a description + logs or screenshot. Please note the "airing now" takes ~1m at startup to display a value.

Also, as a track is most of the time more than 2 minutes long, cant you imagine refreshing it every 60sec ? I understand it would create an error after 16h/day listenning but who does that ? :)

You probably forget that this integration also runs when you don't listen to your radio.

Finally, i guess the radio france logo would make the integration much smarter ;) The PR for this was merged this morning: https://github.com/home-assistant/brands/pull/4895. You should be able to see the radio france logo in HA at the moment.

Even if you're the man, i'm happy enough having brought the idea to you ;) Good luck with that ! I'm open to all ideas (if possible if you've seen the info your request is present in the API). Please open new issues for each of them to make follow-up easier.

Nikohomeassistant commented 10 months ago

Is it possible to half solve this issue with a button? When you push the button, you get the current track updated.

kamaradclimber commented 10 months ago

It should be technically possible but I would prefer to find an automated solution (I'm waiting for radio france support to get their opinion on what we should do to support this use case).

Nikohomeassistant commented 10 months ago

But we could push this button automatically only when we play a radio station on a media player

kamaradclimber commented 10 months ago

Support in https://github.com/kamaradclimber/radio-france-home-assistant/releases/tag/0.3.0 is much better for FIP and its substations: refresh for FIP is done every 2 minutes which means there is a reasonable chance to have up to date info (while keeping the api key usage under the daily limit).

Next improvement will be when the api will publish data in advance, if it happens.

Nikohomeassistant commented 10 months ago

Hey Good job ! I get update every 2 minutes indeed but one update out of two is unknown.

erjonkers commented 4 months ago

Hi there I think @Nikohomeassistant has a good point in an earlier reply. If we'd only call the API when we're actually listening to a station, we'd lower the overall inefficiency of pulling information 24/7.

Even better, we'd increase the accuracy for FIP when the API load is lower; 60s or even lower would be a option I think.

Conditions I could check to make this work is the combination of:

In the setup of the integration it would be required to add mediaplayers and the url used to stream FIP.

kamaradclimber commented 4 months ago

This is a very valid suggestion, thanks!

I think it corresponds well to a use case specific to FIP: display information when listening to the radio. However, it would miss other use cases such as powering up the radio when a specific song is aired (something that would have been very useful 30 years ago 😅 ).

I’ll see what I can do

erjonkers commented 4 months ago

Got it, thanks either way!!

You could make the 'use api based only under these x conditions' optional (default = always on). Users can create their own boolean helper in such a case. And even allow users to tweak the refresh rate. With the caveat that a max of 1000 requests is in place.