mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 08:25:54 +02:00
[GH-ISSUE #152] [Feature]: Cost Tracking: Set “Electricity cost per kWh” from a Home Assistant entity #93
Labels
No labels
A1
automated
automated
bug
bug
Closed due to inactivity
contrib
dependencies
dependencies
duplicate
enhancement
feedback
hold
invalid
Notes
P1S
pull-request
security
ThumbsUp
user-report
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bambuddy-maziggy-1#93
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fgrfn on GitHub (Jan 25, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/152
Originally assigned to: @maziggy on GitHub.
Problem or Use Case
The current “Electricity cost per kWh” in Cost Tracking is a manually configured static value. For users on dynamic electricity tariffs (e.g., Tibber, Octopus Energy), the price changes frequently (hourly or more).
Because the value in Bambuddy is static, cost calculations can be inaccurate unless users constantly update the setting manually. Many users already have the current electricity price available in Home Assistant via sensors/entities provided by their energy provider integration.
Proposed Solution
Allow the current “Electricity cost per kWh” value to be determined automatically from a selectable Home Assistant entity.
Alternatives Considered
no
Feature Category
Monitoring & Stats
Priority
Nice to have
Mockups or Examples
No response
Contribution
Checklist
@maziggy commented on GitHub (Jan 25, 2026):
What's about an API endpoint to change the price?
@fgrfn commented on GitHub (Jan 25, 2026):
Yes, that should work. Home Assistant can push the price to an API endpoint using rest_command and an automation.
@maziggy commented on GitHub (Jan 25, 2026):
API endpoint is already there. Added docs -> https://wiki.bambuddy.cool/features/energy/?h=dynamic+electricity+rates#dynamic-electricity-rates
Please let me know if it works for you.
@fgrfn commented on GitHub (Jan 25, 2026):
Hi @maziggy , thanks! I tried it, but it doesn’t seem to work.
Home Assistant rest_command call to PATCH http://10.10.10.10:8000/api/settings returns 405 Method Not Allowed.
Error Log:
Error. Url: http://10.10.10.10:8000/api/settings. Status code 405. Payload: b'{"energy_cost_per_kwh": unavailable}'
BamBuddy Container log output:
curl -i -X OPTIONS http://10.10.10.10:8000/api/settings" shows:
It looks like Bambuddy doesn’t expose the PATCH handler for /api/settings ?
@maziggy commented on GitHub (Jan 25, 2026):
Yup, let me check this....
@maziggy commented on GitHub (Jan 25, 2026):
This is now fixed in branch 0.1.6-final. Let me know if it works now.
Please note: endpoint is /api/v1/settings, not /api/settings!!!
Please also note: The error shows b'{"energy_cost_per_kwh": unavailable}' - unavailable is not valid JSON (should be a number or null). You may need to handle unavailable sensor states in your HA automation before sending the request.
@fgrfn commented on GitHub (Jan 25, 2026):
Thanks for the update!
After applying the changes from the 0.1.6-final branch, everything works as expected now 👍
Regarding the endpoint: I already suspected this, but since the docs mentioned /api/settings, I tried that endpoint again before. With the updated version, it’s now clear and working correctly.
The Home Assistant automation example in the docs can’t be used 1:1 in a Home Assistant configuration. The following automation works reliably for me and avoids pushing
unknown/unavailablesensor states.Thanks again for the quick fix and the great work on Bambuddy!
@maziggy commented on GitHub (Jan 25, 2026):
Wiki updated.