Switch rest error - data platform Got none

Hi! Spent a lot trying to integrate my shelly1 thru REST and getting error all the time.
My config:

switch:  
  - platform: rest
    name: "RoomX Light"
    scan_interval: 5
    resource: http://192.168.1.10/relay/0
    verify_ssl: false
    authentication: basic
    username: 'myuser'
    password: 'mypassword'
    body_on: 'turn=on'
    body_off: 'turn=off'
    is_on_template: '{{ value_json.ison == true}}'
    headers:
      content-type: application/x-www-form-urlencoded

I’ve checked indentation, even with yamllint. Ensured auth is ok. But still the same error:

2020-04-05 14:17:24 ERROR (MainThread) [homeassistant.config] Invalid config for [switch]: required key not provided @ data['platform']. Got None. (See /config/switch.yaml, line 1). Please check the docs at https://www.home-assistant.io/integrations/switch

After googling, ensuring all params…still can’t figure out .

If you have created a file called switch.yaml (for configuring all switches) then you should not include switch: as the first line in the file. Remove it.

Thank you so much ! I was sure I already tried that. This made get onto next error

* Invalid config for [switch.rest]: [authentication] is an invalid option for [switch.rest]. Check: switch.rest->authentication. (See /config/switch.yaml, line 0). Please check the docs at https://www.home-assistant.io/integrations/rest

Actually I have my Shelly1 ones protected by passwd, and I saw in the official doc that authentication was possible. Indentation problem ?

According to the documentation for RESTful Switch, there’s no authentication option. Remove it.

1 Like

There is no mention of authentication as an option here:

:frowning: I followed the link reported at the error itself

Please check the docs at https://www.home-assistant.io/integrations/rest

I gues that’s just REST generic?
So I must give up having a passwd at my shellys if I want to integrate them via REST (not mqtt) ??

Why do you say you have to give up having a password? Both username and password are valid options (refer to the documentation link).

Screenshot from 2020-04-05 14-42-23

1 Like

Great ! Removed the authentication option and finally working! THANKS a lot to you both.

I followed https://www.home-assistant.io/integrations/rest and there I saw option authentication

1 Like

That’s the documentation for the rest sensor:

I’ve thought more than once that the title of that page needs changing.

I’ll open a pull request to get it changed to ‘RESTful Sensor’

1 Like

Thanks. Getting started with HA. I’ll have to read much more in general.