lawrencefoley / evergy

A simple utility that you can use to access your Evergy account and retrieve you meter readings.
MIT License
31 stars 13 forks source link

Evergy Updated API? #5

Closed pman07 closed 3 years ago

pman07 commented 3 years ago

Are you having any issues with this? Mine has stopped working since January 13th, it seems like Evergy might have adjusted their API. I haven't dug into it much, just curious if you're having the same issue. I'm getting an error message like I'm not logged in when running GetUsage.

lawrencefoley commented 3 years ago

@pman07 Thank you for letting me know! I haven't used this library for a bit so I didn't know this broke. However, I did get an email from them saying that they were going to do maintenance on 1/13 so they probably changed their API.

I'll have to see if I can put in a fix when I have some time.

maintenance screenshot

pman07 commented 3 years ago

That's what made me suspect they tweaked the API. I'm using a slightly edited version to calculate my total cost since I had Solar installed, to then calculate my savings. Your code has worked extremely well. I'll see what I can figure out in the meantime. Thank you for your work!

pman07 commented 3 years ago

Dug into it some tonight, I'm getting login response 500 : internal server error. Will look into it more tomorrow.

pman07 commented 3 years ago

I did some troubleshooting, if I change the login url to "https://www.evergy.com" I get a 200 response. But it seems like my session isn't staying logged in. When I log the r.text from "https://www.evergy.com/ma/my-account/account-summary/single-account" it's the "Log In" page again.

I am using an adapted version to get this running on Home Assistant in pyscript, so it's not identical to your code. I'm curious if yours is broken as well, or if I need to figure out an issue with the pyscript iteration.

lawrencefoley commented 3 years ago

@pman07 I was getting the same error. This should resolve the issue. Let me know if it works on your end.

Also, I've been looking using Home Assistant myself. I'd be curious to see how you're using this code with that if you're willing to share. 😃

pman07 commented 3 years ago

You're the man! Yessir, that fixed my issue as well, that was way beyond me lol. After all your hard work of course I'll share my setup. I'm calculating my actual evergy cost since my solar install date, which is then used to calculate my solar savings on the fly. I have an automation calling pyscript.getevergyusage every day at 7 am.

I installed the custom component pyscript Git Link I adjusted the kcpl.py script (see attached). Sorry it's a mess, I had it somewhat clean, but really wrecked it troubleshooting.

kcpl.txt

Let me know if you have any questions or come up with anything cool. Thanks again for your quick help!

pman07 commented 3 years ago

@lawrencefoley If you want more info about the rest of my Home Assistant setup I can share more info as well. Here is a screenshot of my solar/ev savings tab where I'm displaying the calc used by your code.

image

lawrencefoley commented 3 years ago

@pman07 Thanks! Happy to help!

That's really cool how you're able to track your savings with solar. If I start using Home Assistant I might make a version of this that could be used directly in HA.

pman07 commented 3 years ago

@lawrencefoley that'd be awesome!

kreene1987 commented 3 years ago

Poking in from another HA user that ran into this from google search. How are you currently implementing this that I might replicate? Would love to get my daily usage tracked and automations to fire based on usage.

In addition, have either of you gotten Kansas Gas Service data at all?

pman07 commented 3 years ago

Poking in from another HA user that ran into this from google search. How are you currently implementing this that I might replicate? Would love to get my daily usage tracked and automations to fire based on usage.

In addition, have either of you gotten Kansas Gas Service data at all?

This is my current setup, I've attached my most recent copy of the kcpl.py as kcpl.txt since github won't allow me to attach .py files. kcpl.txt

You're the man! Yessir, that fixed my issue as well, that was way beyond me lol. After all your hard work of course I'll share my setup. I'm calculating my actual evergy cost since my solar install date, which is then used to calculate my solar savings on the fly. I have an automation calling pyscript.getevergyusage every day at 7 am.

I installed the custom component pyscript Git Link I adjusted the kcpl.py script (see attached). Sorry it's a mess, I had it somewhat clean, but really wrecked it troubleshooting.

kcpl.txt

Let me know if you have any questions or come up with anything cool. Thanks again for your quick help!