Change the unit of the rest sensors to a capital “W”. To be used in the energy dashboard the Riemann sensor must have a unit of Wh or kWh, the capitalisation is important.
Replace {{USERNAME}} and {{PASSWORD}} with your own credentials.
You can’t have the access_token on the value_template section because it exceeds 255 characters limited by HA. But we CAN use the sensor’s attribute to call it from the rest integration. Also I set a scan_interval of 43200 seconds (12 hours) even tough the access_token last for 24 hours, just to play it safe.
To do this I modified the rest integration (not the rest sensor platform) to use the attribute on the sensor.curb_token_request on the Authorization parameter.
First of all let me say thank you. I have been trying to find a way to integrate Curb into HA for over a year.
I got everything working up until I tried to automate the token refresh. When I view the sensor.curb_token_request it shows an access_token but the sensors no longer are giving data. I tested the token it gave me using it in a CURL request and it allows me to pull data but for some reason it will not work within HA.
I am using this in my sensors.yaml
You are right I just checked my working code and it does not have the “ on it. I didn’t copy the updated code when doing my post. Glad you got it working.
If you find a way to get webhooks connection to curb’s working on home assistant to get live data and not 1 min refresh data, let me know, but for now this will work.
My coding knowledge is based off chatGPT and copying other peoples code
I made a new thread with an issue I can’t figure out. One of my sensors from curb I am using to see how much power I am returning to grid (NET) which outputs a negative value. Using the sensor for the energy dashboard gives improper data because of the negative value when I am returning power to the grid. I cannot figure out how to properly utilize this sensor so I can have data on energy returned to the grid.
Bumping this thread again because I updated to the newest HA and it seems to have broke everything. What version are you running?
The system cannot restart because the configuration is not valid: Invalid config for [rest]: expected SensorStateClass or one of ‘measurement’, ‘total’, ‘total_increasing’ for dictionary value @ data[‘rest’][0][‘sensor’][12][‘state_class’]. Got None. (See /config/configuration.yaml, line 201).
I ended up updating to the same version as you. The newest version broke too many other things I had setup and I don’t have the time to track down fixes for all of them.
Well I updated to 2023.8 and I don’t have any problems with the sensors or the rest platform. If you have the time share your full rest config for curb so we can see what might be causing it.
Hello, I know this is much later, but I am going through this thread trying to recreate this for my Curb setup. I am able to pull my access token and get all my values via curl commands as you have documented above, so I am hoping that I am just missing something.
I don’t see any evidence of it failing in the logs, but I don’t see my sample sensor show up for sensor 0.
Thank you! This thread has been awesome and has helped me get Curb up and running when the search results normally seem to imply it can’t be done. This has been a huge help, if there’s a way to buy you a coffee let me know. Also for anyone else finding this, I had a typo in my configuration.yaml, here’s a working example:
I’m glad to help and that you solved your problem, currently I’m still trying to get live data from curb and not 1 min refresh data into Home Assistant, if I make it happen I’ll update this same thread.
If you wish to buy me a coffee you can do so here.