ha-smartmetertexas
ha-smartmetertexas copied to clipboard
No readings Returned
Making new issue as well as commenting on old similar issue..
It appears this could be happening again... Last data it grabbed was on Nov. 11 at 11:50pm... Nothing since then.
Getting an "ECONNRESET" error on the "Log In" node and "Request Read" Node.
Running HA 2022.11.2 through virtual machine.
Looks like they may be blocking access.
First https://smartmetertexas.com
isn't working for me; I had to update it to https://www.smartmetertexas.com
Second, when testing the authenticate post in Postman I get an access denied error:
<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
You don't have permission to access "http://www.smartmetertexas.com/api/user/authenticate" on this server.<P>
Reference #18.85ed19b8.1668529535.a90ff58
</BODY>
</HTML>
EDIT: With some cursory testing -- it looks like it's requiring cookies present after loading the home page (e.g. via browser) to be passed back with the authentication request. Trying without the Cookie
header in curl gives me the above error, but copying the cookie from the request in Firefox and running the curl command will work.
@shbatm how did you get it work with adding the cookie? Have you tried Postman or Iosomina? If so do you have a screen shot of your code or curl command
I was only able to mess with it briefly today--I captured the network requests with Firefox Dev-Tools (right-click>Inspect, Network Tab) which lets you copy the requests as curl
. Using the curl
commands I tried a few things on the command line and compared to the requests from Postman and NR.
Summarizing what I found: browsing to http://www.smartmetertexas.com
redirects you to /dashboard
, sets 4 cookies, and sends you to the login screen. When you log in, the cookies are sent back in the header. I took this response and "replayed" it as-is in curl
and got the expected JSON
response back. When I dropped the cookie header, I would get the above Access Denied. Got the same Access Denied from Postman and from NR.
Thank you for that. It appears if i copy the curl and run it runs fine but if I import into postman it fails.
home-assistant/core/issues/57582 has a lot of information that retains this issue. It appears to have been a issue with SMT. Where www. point to their CDN but doman.com pointed to there server and they have since turn off going straight to the domain.
So grabbing the cookies and sending them back in the header, would that make it possible to add those into the node-red flow? I've been watching this and the core integration issue to see what people are doing.
I will work on a way to handle the cookies, but it may take a bit to get implemented and tested.
I'm more of a backend developer but I can fumble my way through with some instructions. Happy to test (working around family coming into town this week).
I've done some digging and testing on this myself, and I believe they have bot detection/protection from Akamai running, which is preventing this from working. I was playing/testing a lot with headers and cookies (was even storing the cookies and trying to send them with my POST for authentication without any luck). I was testing with Postman as well, and even it was failing. More details here:
https://www.zenrows.com/blog/bypass-akamai https://stackoverflow.com/questions/69562016/akamai-sensor-data-generator-for-a-valid-abck-cookie-on-post-request-python https://github.com/zedd3v/abck
The HA integration has started working again. Not sure about the Node-Red integration
The HA integration never worked for me. Just tried it and it works now. Interesting.
NodeRED Flow is working again for me (removed www.
)
The node-red flow appears to be working for now. Let's see how long it takes from them to break it now.
This is the response I'm getting back:
An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.
If you are the system administrator of this resource then you should check the error log for details.
Faithfully yours, nginx.
Looks like it happened again.... smart meter Texas upgraded their service to SMT V2 and it broke... looks like it affect the integration version as well..
https://github.com/home-assistant/core/issues/111118
Any update on this? I'm still not able to get this integration working since SMT updated.
I think I've narrowed the problem down to a few things:
- The API authentication URL has changed to
/commonapi/user/authenticate
- The Headers must contain a user-agent.
- The request must be an
HTTP/2
request -- which I cannot find out how to support from Node-RED.
I was able to get a rough python script working to prove that it's still viable:
https://gist.github.com/shbatm/d10a703cc3e3817e9bf53fec9eae52a6
I just haven't been able to get the Node-RED Flow back working since I can't find much on the request node's support for HTTP/2.
I did some playing in Node-RED and got it to work (at least for one read, so we'll see if it continues working).
I updated all the "Apply HTTP Config" entities with all the updated headers from your example, then replaced all the https-node entities with regular http request entities and configured them the same with the exception of the first one that authenticates where I used your updated URL.
See if it works for anyone else.
Edit: attached my flow here smart-meter-texas-flow.json
Your updated flow is working for me...thanks
~I forked the repo and made it using various solutions offered by several people, like @mflagler (Thanks for sharing your flow!). Since I think this repo has become inactive, I decided to create a fork that I will maintain as best as I can, and I included two flows, one of which will parse data to mqtt, and the other to home assistant via custom node red integration. Give it a try and let me know how it works!~
I have been corrected, and will be submitting a PR.
This repo isn't inactive per-se. I just don't directly use this integration as I initially created it for a friend (I have local power monitoring). I'm happy to merge the changes if you wish to submit a PR.
On Fri, Apr 12, 2024 at 1:35 PM Indianb0y016 @.***> wrote:
I forked the repo and made it using various solutions offered by several people, like @mflagler https://github.com/mflagler (Thanks for sharing your flow!). Since I think this repo has become inactive, I decided to create a fork that I will maintain as best as I can, and I included two flows, one of which will parse data to mqtt, and the other to home assistant via custom node red integration. Give it a try and let me know how it works!
— Reply to this email directly, view it on GitHub https://github.com/stmrocket/ha-smartmetertexas/issues/14#issuecomment-2052269968, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETJ6CKGJORWZ7C5STBR4HDY5ASOVAVCNFSM6AAAAAASBA6QOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJSGI3DSOJWHA . You are receiving this because you commented.Message ID: @.***>
This repo isn't inactive per-se. I just don't directly use this integration as I initially created it for a friend (I have local power monitoring). I'm happy to merge the changes if you wish to submit a PR. … On Fri, Apr 12, 2024 at 1:35 PM Indianb0y016 @.> wrote: I forked the repo and made it using various solutions offered by several people, like @mflagler https://github.com/mflagler (Thanks for sharing your flow!). Since I think this repo has become inactive, I decided to create a fork that I will maintain as best as I can, and I included two flows, one of which will parse data to mqtt, and the other to home assistant via custom node red integration. Give it a try and let me know how it works! — Reply to this email directly, view it on GitHub <#14 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETJ6CKGJORWZ7C5STBR4HDY5ASOVAVCNFSM6AAAAAASBA6QOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJSGI3DSOJWHA . You are receiving this because you commented.Message ID: @.>
Ahh my apologies. I figured since the last pull request hadnt been merged, I assumed that it was no longer active. Im still learning github, so I apologize. Allow me to take down my fork references and modify it for merging.
This repo isn't inactive per-se. I just don't directly use this integration as I initially created it for a friend (I have local power monitoring). I'm happy to merge the changes if you wish to submit a PR. … On Fri, Apr 12, 2024 at 1:35 PM Indianb0y016 @.> wrote: I forked the repo and made it using various solutions offered by several people, like @mflagler https://github.com/mflagler (Thanks for sharing your flow!). Since I think this repo has become inactive, I decided to create a fork that I will maintain as best as I can, and I included two flows, one of which will parse data to mqtt, and the other to home assistant via custom node red integration. Give it a try and let me know how it works! — Reply to this email directly, view it on GitHub <#14 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETJ6CKGJORWZ7C5STBR4HDY5ASOVAVCNFSM6AAAAAASBA6QOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJSGI3DSOJWHA . You are receiving this because you commented.Message ID: _@**.**_>
Ahh my apologies. I figured since the last pull request hadnt been merged, I assumed that it was no longer active. Im still learning github, so I apologize. Allow me to take down my fork references and modify it for merging.
No problem! Funny thing is, I was thinking I needed to get that other PR merged at some point soon just the other day. I see your PR and will try to get it reviewed and merged shortly. Thank you!
Gave @Indianb0y016 flow a try (NodeRed with HA, no MQTT) and got my first reading! I will keep watching to see how it does for the next day.
The fixes from @Indianb0y016 have been merged into this repository via PR #15