Rest API calls no longer update

I have been fetching the data from this link for quite some time. Lately, the values in HA in no longer updating as per the values in the link.

Would anyone know of why this is happening?

- platform: rest
  name: solat
  resource: https://www.muis.gov.sg/api/pagecontentapi/GetPrayerTime
  scan_interval: 21600
  json_attributes:
    - Subuh
    - Syuruk
    - Zohor
    - Asar
    - Maghrib
    - Isyak

That will update every 6 hours. There’s nothing wrong with your yaml, so verify you have access to that endpoint.

The values that are present in the sensors are from a week ago.

I have not been able to get it to update to these real-time values ever since then.

Troubleshooting that was done include:
Removing scan interval,
Restart HA,
Restore to previous working backup.

All methods has so far failed to produce the value updates.

Check your logs, there’s nothing out of the ordinary with your setup.

You don’t have a unique_id defined; is there a possibility that you have multiple sensors with the same name and you’re looking at the wrong one? Check if there is a sensor.solat_2 or some other entity like that in your list.

Thank you for your insight.
I have now went through dev tools/states and found that there is only one sensor.solat which has all the values, but the date is stated as 20 November 2023. This can confirm that the last time the values were updated were on that date.

How do I determine if HA is still able to fetch real-time values from the link provided in the OP?
In regards to the unique_id, it seemed that I have only one of this in the list of entities based on devtools/states.

The rest of the code for these sensors,

- platform: template
  sensors:
    syuruk:
      friendly_name: Syuruk
      unique_id: Syuruk
      value_template: "{{ as_timestamp(strptime(state_attr('sensor.solat', 'Syuruk')~' AM', '%I:%M %p')) | timestamp_custom('%H:%M') }}"

- platform: template
  sensors:
    subuh1:
      friendly_name: Subuh
      unique_id: subuh1
      value_template: "{{ as_timestamp(strptime(state_attr('sensor.solat', 'Subuh')~'AM', '%I:%M %p')) | timestamp_custom('%H:%M') }}"

- platform: template
  sensors:
    zuhur1:
      friendly_name: Zohor
      unique_id: zuhur1
      value_template: "{{ as_timestamp(strptime(state_attr('sensor.solat', 'Zohor')~' PM', '%I:%M %p')) | timestamp_custom('%H:%M') }}"

- platform: template
  sensors:
    asar1:
      friendly_name: Asar
      unique_id: asar1
      value_template: "{{ as_timestamp(strptime(state_attr('sensor.solat', 'Asar')~' PM', '%I:%M %p')) | timestamp_custom('%H:%M') }}"

- platform: template
  sensors:
    maghrib1:
      friendly_name: Maghrib
      unique_id: maghrib1
      value_template: "{{ as_timestamp(strptime(state_attr('sensor.solat', 'Maghrib')~' PM', '%I:%M %p')) | timestamp_custom('%H:%M') }}"

- platform: template
  sensors:
    isyak1:
      friendly_name: Isyak
      unique_id: isyak1
      value_template: "{{ as_timestamp(strptime(state_attr('sensor.solat', 'Isyak')~' PM', '%I:%M %p')) | timestamp_custom('%H:%M') }}"

As petro said, check your logs. If you don’t see anything relevant, go to developer tools—> YAML and scroll down to find the button to reload your rest entities. Then check the logs again.

Unfortunately, nothing relevant came from the logs that can direct me to the issue that needs to be resolved.

(I have updated through devtools/yaml/rest entities and notify services)

This is what was retrieved from the sensor
sensor.solat
{“PrayerDate”:“20 November 2023”,“Hijri”:“6 Jamadilawal 1445H”,“Subuh”:“5:28”,“Syuruk”:“6:49”,“Zohor”:“12:52”,“Asar”:“4:15”,“Maghrib”:“6:53”,“Isyak”:“8:06”}

Is there a tool/an advise on how I can determine if I am allowed to scrape from the API link?

If you can get to a command prompt on your HA instance, you can use curl to check. It works here:

Thank you for this,

It is my first time using it for this; however the result I get differs from yours.

Would there be a reason why this is so?
(could it be they have blocked my access to this?)

If they blocked it, you would not get a response. This looks like there’s something caching the result for speed, and not realising it is transient data. Are you maybe using a service for web accelleration like a proxy cache or some other bandwidth saving feature?

Interesting, I am not aware of any web acceleration service/bandwidth saving tool that I voluntarily installed/integrate onto my home assistant or router.

Unfortunately, I am not equip on how to ascertain this.

Huh: just loaded that in my browser and got yesterday’s info, despite getting today’s from the curl command.

The same thing happened to me.
I have not found a way to “bruteforce” a fetch through the API to update on my HA.

If you were me trying to get these updates to work as per what it was, would you troubleshoot further or try and retrieve the values elsewhere, such as this link here

To be honest, I rather find a solution to the current issue to understand further through troubleshooting. This could possibly increase my knowledge on this matter.

Turn on debug logging for rest and see what it’s doing.

Hi Pedro, I have turned it on and yet to see anything that should be of concern.

What should I be seeing?

Hi, I have the same error. The date pulled seems to be stuck at a certain date. Using other devices gives me different dates on the same api website.

Did you manage to find a solution?

Unfortunately, I did not. I hope someone managed to source a solution for this and will share their insights here.

Hi. sorry to bump an old thread. I did find a solution to this.

We need a “cache buster”.
Thus, I added “?v=1625627373” at the back of the link.
“https://www.muis.gov.sg/api/pagecontentapi/GetPrayerTime?v=1625627373”

“1625627373” is just random numbers to force the data to be updated to the current date.

I am currently looking to find a way to automate these random numbers to generate a new one each day without me manually changing the numbers each day through file editor.

Havent got a clue on how to do this yet.

just use ? at the end