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

Data is not pulled from Yasno correctly #31

Open
Fisarl opened this issue Nov 19, 2024 · 8 comments
Open

Data is not pulled from Yasno correctly #31

Fisarl opened this issue Nov 19, 2024 · 8 comments

Comments

@Fisarl
Copy link

Fisarl commented Nov 19, 2024

Hello @denysdovhan ,

First of all, thank you for this wonderful integration! However, since yesterday, I’ve noticed that the electricity outage plans have been updated on Yasno, but these updates are not reflected in your integration.

Data in HA:
image

Data at Yasno:
image

It seems that, for some reason, "possible outages" are still present in your integration, even though Yasno has removed them from their website.

@denysdovhan
Copy link
Owner

Hey, I am aware of this issue. Yasno now returns two types of schedule on their unofficial API: regular and daily schedule.

  • regular - is the schedule currently being used. It's still relevant, but it doesn't include data from Ukrenergo.
  • daily - is a schedule that gets published on daily basis. Basically, it's an intersection of regular schedule and timeframes from Ukrenergo.

This change shouldn't be hard to make, but I don't have much time for that. I will try my best to make necessary changes as soon as possible.

@asp24
Copy link

asp24 commented Nov 19, 2024

@denysdovhan it's looks same

curl https://api.yasno.com.ua/api/v1/pages/home/schedule-turn-off-electricity | jq '.components[] | select( .template_name == "electricity-outages-schedule" and ( .available_regions[] | contains("kiev"))) | .schedule.kiev.group_2'

and

curl https://api.yasno.com.ua/api/v1/pages/home/schedule-turn-off-electricity | jq '.components[] | select( .template_name == "electricity-outages-daily-schedule" and ( .available_regions[] | contains("kiev"))) | .schedule.kiev.group_2'

or you know other api?

@Maxim-Inv
Copy link

@asp24
Yes, dictionary electricity-outages-daily-schedule contains a new schedule of outage.

@denysdovhan
I tried to implement it in my fork but wasn't able to test it before PR. I added my repo to HA instead yours (before removed it), but the integration didn't appear. Why it can be?

@asp24
Copy link

asp24 commented Nov 20, 2024

@Maxim-Inv in this case it will not help. Data returned inside electricity-outages-daily-schedule differs from rendered on the page. Proper schedule rendered into HTML on the backend. The minimal request to recieve it looks like this curl -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' --cookie 'region=%7B%22id%22%3A44%2C%22name%22%3A%22%D0%9A%D0%B8%D1%97%D0%B2%22%2C%22key%22%3A%22kiev%22%2C%22subdomain%22%3A%22kyiv%22%7D' https://yasno.com.ua/schedule-turn-off-electricity

Nobody likes to parse HTML, but I did not find any XHR request returning "right" schedule

@denysdovhan
Copy link
Owner

You should look for dailySchedule property, not schedule.

@asp24
Copy link

asp24 commented Nov 20, 2024

@denysdovhan Tnhx. I've missed this. Here is right filter for any who will be interested building other implementations

curl  https://api.yasno.com.ua/api/v1/pages/home/schedule-turn-off-electricity | jq '.components[] | select( .template_name == "electricity-outages-daily-schedule" and ( .available_regions[] | contains("kiev"))) | .dailySchedule.kiev.today.groups'

@EvGeniyLell
Copy link

@denysdovhan, can we expect an update to this plugin to include dailySchedule?

@denysdovhan
Copy link
Owner

can we expect an update to this plugin to include dailySchedule?

Yes, you can. I am in the process of integrating a new type of schedules. Work in progress. Can't give you any precise estimates, since I have my day-to-day job anyway.

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

5 participants