I’m trying to use the MyStrom buttons, and these work through an API call back to home assistant. I’m struggling with the authentication. I have an API password set:
auth_providers: - type: homeassistant - type: trusted_networks trusted_networks: - 192.168.0.0/21 - 192.168.1.40 - 172.17.0.0/24 - fd00::/8 - type: legacy_api_password api_password: !secret api_password
However when I try to test the API with curl, I get
$ curl -X GET -k "https://walker:8123/api/mystrom?api_password=##########&single=myStromButton01" 401: Unauthorized
I can get it working with a header and a bearer token:
$ curl -X GET -k -H 'Authorization: Bearer <LongToken>' "https://walker:8123/api/mystrom?single=myStromButton01"
however I don’t know how I can put a header into the MyStrom button config (I seem to only be able to program this with the URL (and the docs say to put
api_password=##### into the URL, which is not working. The button (and the computer I was running
curl from) are in the trusted network ranges.
Is there a way I can allow the switches to work without the token (using either
api-password or by exempting them from authorisation?