HomeAssistant Authorization issue on raspberry pi controlling Dyson DPO4

Hi,
I am trying to do the following project, I installed home assistant on a raspberry pi 4 and I have a dyson air purifier DP04.
The home assistant is able to see the dyson and I can control it from the web gui however I need to be able to use the curl command from the raspberry and I have an authentification error

i@raspberrypi:/home/homeassistant/.homeassistant $ curl -X POST -H "x-ha-access: " -H “Content-Type: application/json” -d ‘{“entity_id”: “fan.living_room”}’ http://192.168.1.5:8123/api/services/fan/turn_on
401: Unauthorized

2020-11-10 12:03:48 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 192.168.1.5 (192.168.1.5) (curl/7.64.0)
I read about the changes with home assistant and I have added the trusted network in configuration yaml but I still get the same error
homeassistant:
auth_providers:
- type: trusted_networks
trusted_networks:
- 192.168.1.0/24
- 127.0.0.1
- ::1
home assistant 0.117.5

I’d change the title to reflect a Dyson dp04 is involved, then relevant people can help out

Thank you , I will do that

1 Like

I think I figured it out, not sure if this is the right way but I used long-lived access token and used it in the curl command

curl -X POST -H "x-ha-access: " -H “Content-Type: application/json” -d ‘{“entity_id”: “fan.living_room”}’ http://192.168.1.5:8123/api/services/fan/turn_on -H ‘Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJiODEzYzFlZDU0NmY0NTBlYWRiZmQxODk0NmFkMzk0ZCIsImlhdCI6MTYwNTAwNzk4MywiZXhwIjoxOTIwMzY3OTgzfQ.Mo5-Va-FJ-uuZF5FTnrz8xyrsscyCWJR4F8_4RVxlvg’

this made my dyson start