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

Smart Meter Texas not authenticating #111118

Closed
Gamerz261 opened this issue Feb 21, 2024 · 12 comments · Fixed by #116321
Closed

Smart Meter Texas not authenticating #111118

Gamerz261 opened this issue Feb 21, 2024 · 12 comments · Fixed by #116321

Comments

@Gamerz261
Copy link

The problem

After SMT's upgrade to SMT v2, the integration has gone dead, causing an error when adding the integration. There is a new interface guide AVAILIABLE HERE.

What version of Home Assistant Core has the issue?

core-2024.2.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Smart meter Texas

Link to integration documentation on our website

https://www.home-assistant.io/integrations/smart_meter_texas/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Integration failure does not appear in logs. Multiple different comments have recently been made on issues on the SMT Integration specific github.

@home-assistant
Copy link

Hey there @grahamwetzler, mind taking a look at this issue as it has been labeled with an integration (smart_meter_texas) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of smart_meter_texas can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign smart_meter_texas Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


smart_meter_texas documentation
smart_meter_texas source
(message by IssueLinks)

@TGrounds
Copy link

There is another thread about this that many have been posting in. It seems that Smart Meter Texas did an update to their services back in January and it stopped working for everyone that is using it. Most of us have removed it and tried to re-add it and continue to get the failed authentication. I really liked this integration and would love to have it available again.

@TGrounds
Copy link

Any update on this integration? It is still not working since the update.

@shbatm
Copy link
Contributor

shbatm commented Apr 4, 2024

From my comments on the NodeRED flow...

I think I've narrowed the problem down to a few things:

  1. The API authentication URL has changed to /commonapi/user/authenticate
  2. The Headers must contain a user-agent.
  3. The request must be an HTTP/2 request -- which I cannot find out how to support from Node-Red and don't know enough about core's web sessions to fix here.

I was able to get a rough python script working to prove that it's still viable:

https://gist.github.com/shbatm/d10a703cc3e3817e9bf53fec9eae52a6

@binn
Copy link

binn commented Apr 6, 2024

this needs to be fixed or removed from HA

@Gamerz261
Copy link
Author

Gamerz261 commented Apr 7, 2024 via email

@Indianb0y016
Copy link

I think I've narrowed the problem down to a few things:

1. The API authentication URL has changed to `/commonapi/user/authenticate`

2. The Headers must contain a user-agent.

3. 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.

Thank you for sharing this script. Out of curiosity, I ran this script myself and was also able to successfully run this and retrieve a reading. Based on this, I think it shouldn't be too difficult to make the necessary changes. If not, I think another option would be to use appdaemon or something similar to implement the script and return the reading as an entity.

@mflagler
Copy link

mflagler commented Apr 9, 2024

Doesn't the official integration use this package: https://github.com/grahamwetzler/smart-meter-texas
Maybe start playing with it and seeing if some tweaks can get it working and submit a pull request to get the official integration working again. I may play with node-red, but not much is talked about using HTTP/2.

I did some playing with Node-Red and was able to get the flow for it working:
stmrocket/ha-smartmetertexas#14 (comment)

@Nitr0Sage
Copy link

If you change line 5 at const.py from "api" to "commonapi" it should work, I don't mess with python so I don't know how to test it.
Then if you need to change user agents at line 13-21 is where it would need to be changed
I was also able to get @shbatm script working

@Indianb0y016
Copy link

Indianb0y016 commented Apr 12, 2024

I decided to fork the nodered flow method of polling data, because it seemed like many people were using it for a while until this integration was created. But that repo has gone inactive, so I forked it and I hope to maintain it more regularly. Please give it a try if youd like! I included the home assistant entity method flow and another mqtt method flow for those who want to.

Update: Original repo author responded rather rapidly, so I will be submitting PRs to fix the original project.

@Nitr0Sage
Copy link

@Indianb0y016 Hey, not sure what I'm doing wrong with the node-red flow but it grabs the energy usage at 46,000 kWh, not sure what I'm supposed to do to get the right number

@Indianb0y016
Copy link

Indianb0y016 commented Apr 13, 2024

@Indianb0y016 Hey, not sure what I'm doing wrong with the node-red flow but it grabs the energy usage at 46,000 kWh, not sure what I'm supposed to do to get the right number

That seems to be correct. The reading you are getting is normal. Reason for this is because the ondemand reading is reading the total energy usage as recorded at the meter. I dont know when the meter exactly resets this number, but in the past, I have seen the number be as high as 400,000. In our household, we dont use this much energy at all, as we try to be energy conscious and save money. So I just chalked it down to meter number reading. When used in the energy dashboard, the number increases as expected and doesnt mess up any numbers. That is, until the meter does reset eventually. But I have yet to test this, as there isnt a way for me to do this. I could be wrong about the meter numbers, but this is how its been from the beginning, as I understand.
UPDATE: I went outside and checked the meter to verify if my thoughts are correct. They appear to be so. Meter is reading the same as what was last reported when polled. It went up by 2kwh since the last pool (we have a pool fountain). So it displays the total kwh that the meter has been reading since its last reset, which I do not know when it gets reset. But, in essence, you are on the right track and what data you got appears to be normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants