core icon indicating copy to clipboard operation
core copied to clipboard

Incorrect power price displayed by Flick Electric integration

Open stuartmaxwell opened this issue 6 months ago • 6 comments

The problem

I have noticed that the Flick integration is incorrectly displaying the "controlled" power price during off-peak times, even though I am on an uncontrolled rate.

For example, right now during off-peak hours, my actual power price is 18.406c (inc GST), but the integration is showing 17.589c (ex GST). If I add GST to that I get 20.22735c and if I look at the Flick pricing page for my address, I can see that 20.23c is the advertised rate for controlled pricing. I have confirmed that I'm definitely on uncontrolled pricing by checking my recent bills from Flick.

During peak times, the Flick integration does provide the correct price, so this appears to only be a bug with the off-peak price. For example, the last peak price reported by the integration was 27.979c, and if I add GST to this (32.17585), it correctly matches my peak pricing of 32.176c.

Let me know if I can provide further info.

What version of Home Assistant Core has the issue?

core-2025.5.1

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

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

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet


Anything in the logs that might be useful for us?


Additional information

No response

stuartmaxwell avatar May 09 '25 23:05 stuartmaxwell

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

Code owner commands

Code owners of flick_electric 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 flick_electric 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)


flick_electric documentation flick_electric source (message by IssueLinks)

home-assistant[bot] avatar May 09 '25 23:05 home-assistant[bot]

The integration is using the API provided by Flick to fetch the power pricing information for the current interval. As far as I can tell, there's not any filtering being done to select uncontrolled/controlled values.

If this information is incorrect, that means either the Flick API is returning the wrong data for you, or the API response has changed and we'll need to adjust accordingly.

Unfortunately, I didn't get around to implementing my diagnostics PR (#138019) but I am going to revive that - so hopefully you can get the raw pricing data in the next HA patch release. Assuming the API response is indeed incorrect, then it can be passed on to Flick's team to look into.

ZephireNZ avatar May 09 '25 23:05 ZephireNZ

Thanks for the quick response. Yes, I had a look at your PyFlick library and I think the problem lies there rather than this integration. Happy to submit the issue and work with you there if you prefer.

I was just looking in the Flick Dashboard, and they use very different APIs to the ones in PyFlick. For example, to get customer accounts you could use "https://api.flick.energy/customer/user_accounts_info" which also includes the "supply_node_ref" attribute. And possibly the "https://api.flick.energy/pricing/rate_cards" endpoint for getting pricing, but there's a lot of info in this API request that would take some time to understand.

stuartmaxwell avatar May 10 '25 01:05 stuartmaxwell

The APIs being used currently were ones that Flick themselves had requested we use (previously HA was using ones scraped from the mobile app) so I am not really keen to change it unless they say we should.

I have PR https://github.com/home-assistant/core/pull/144593 to add diagnostics, but if you're technical enough to be able to call the flick API directly to get the API response that'd be awesome.

Check if any of the requests you mentioned above have a bearer token in them (to save you having to generate it yourself), it'll be in the HTTP headers as Authorization: Bearer eyJxxxxxx.

Then do:

curl -H "Authorization: Bearer eyJxxxxx" https://api.flick.energy/rating/v1/rated_period?include=components&supply_node_ref=<your_supply_node>"

The only other thing I can think of is that your supply node ref in the HA configuration is incorrect - eg at some point you moved, or Flick changed it but results can still be returned for the old one.

ZephireNZ avatar May 10 '25 23:05 ZephireNZ

Again slightly annoying to fetch the supply node ref until my diagnostics PR is merged, but you can also see it in your HA configs (be careful not to change anything!)

In /path/to/homeassistant/.storage/core.config_entries there'll be an entry with "domain": "flick_electric",.

If that doesn't match what the Flick app/website uses, try to reconfigure/recreate the integration which should hopefully find the correct one.

ZephireNZ avatar May 10 '25 23:05 ZephireNZ

Thanks - I started my own fork of PyFlick to try out some of the other APIs, but if you've been asked by Flick to use specific endpoints, then I don't really want to create a pull request. But you can check out my progress here: https://github.com/stuartmaxwell/PyFlick

I made it easier to get the supply_node_ref, but I haven't found an easy way to get the correct pricing.

stuartmaxwell avatar May 11 '25 00:05 stuartmaxwell

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.