Homeassistant Switch Problems with no Power Entity
Closed this issue · 16 comments
Describe the bug
When the homeassistant-switch charger template is configured, EVCC continuously issues unauthenticated requests to Home Assistant (GET /api/states/...) and logs a repeating 404: Not Found.
The component keeps polling, causing log spam and confusion. E
- Configure a charger using the homeassistant-switch template.
- Start EVCC with -l trace.
- Observe repeated requests to Home Assistant and repeating 404 lines.
`chargers:
- name: knx_steckdose
type: template
template: homeassistant-switch
baseurl: http://homeassistant.local:8123
token:
switchentity: switch.haustur_steckdose
standbypower: 15`
[ha-switch] TRACE 2025/09/16 23:27:44 GET http://homeassistant.local:8123/api/states/ [ha-switch] TRACE 2025/09/16 23:27:44 404: Not Found [ha-switch] TRACE 2025/09/16 23:27:44 GET http://homeassistant.local:8123/api/states/ [ha-switch] TRACE 2025/09/16 23:27:44 404: Not Found (repeats…)
Steps to reproduce
- Configure a charger using the homeassistant-switch template.
- Start EVCC with -l trace.
- Observe repeated requests to Home Assistant and repeating 404 lines.
...
Configuration details
chargers:
- name: knx_steckdose
type: template
template: homeassistant-switch
baseurl: http://homeassistant.local:8123
token: <token>
switchentity: switch.haustur_steckdose
standbypower: 15Log details
[ha-switch] TRACE 2025/09/16 23:27:44 GET http://homeassistant.local:8123/api/states/
[ha-switch] TRACE 2025/09/16 23:27:44 404: Not Found
[ha-switch] TRACE 2025/09/16 23:27:44 GET http://homeassistant.local:8123/api/states/
[ha-switch] TRACE 2025/09/16 23:27:44 404: Not Found
(repeats…)
What type of operating system or environment does evcc run on?
HomeAssistant Add-on
External automation
- I have made sure that no external automation like HomeAssistant or Node-RED is active or accessing any of the mentioned devices when this issue occurs.
Nightly build
- I have verified that the issue is reproducible with the latest nightly build
Version
No response
Yes the Long lived token is required :-) expected behavior even when running as ha addon
Token is installed.
If it is working close the issue if not update information since original issue was " without providing token."
Sorry, that was wrong.
you might need quotes around the token..
I configured an HA switch in the ui... and see the same 404 when testing the switch...
it is getting the Information but also seems to do 2 other calls to states
[ha-switch] TRACE 2025/09/17 09:12:04 GET http://10.100.1.2:8123/api/states/
[ha-switch] TRACE 2025/09/17 09:12:04 404: Not Found
[ha-switch] TRACE 2025/09/17 09:12:04 GET http://10.100.1.2:8123/api/states/
[ha-switch] TRACE 2025/09/17 09:12:04 404: Not Found
[ha-switch] TRACE 2025/09/17 09:12:04 GET http://10.100.1.2:8123/api/states/input_boolean.test
[ha-switch] TRACE 2025/09/17 09:12:04 {"entity_id":"input_boolean.test","state":"on","attributes":{"editable":true,"friendly_name":"Test"},"last_changed":"2025-09-17T07:02:55.810278+00:00","last_reported":"2025-09-17T07:02:55.810278+00:00","last_updated":"2025-09-17T07:02:55.810278+00:00","context":{"id":"01K5B7QH229S8S7C4NS42W3FE0","parent_id":null,"user_id":null}}
I guess it should query the powerEntity only if configured....
@spuky indeed, it seems like it will poll the status no matter what. this may be related: #23312 (comment)
and also provide success during config..
https://github.com/user-attachments/assets/d0720abf-ae53-4152-9336-9bf4997ac165
ok so gh does not show inline video :-(
I did it first via gui and then again with yaml configuration. Both have mainly the same issue.
@cookingeek Can you adjust the title to: Homeassistant Switch Problems with no Power Entity
Can I test your changes?
if you know how to compile evcc feel free to do so...
other option is to create an number helper with a 0 in ha and provide that as a power entity.. if you only whant a clean log...
For the moment the best Option is to fake the Power Entity in HA by creating an template helper...
Example for a device that pulls 300W when on :
{{ 300 if is_state('switch.exampledevice', 'on') else 0 }}