REST switch not showing up

Tags: #<Tag:0x00007f7393450070> #<Tag:0x00007f739606ff48>

Hi there,

As you might guess from this post I’m an absolute beginner with HA. I’m trying to add one Shelly 1 to Home Assistant and to do so I’m trying to set up a RESTfull switch.

The thing is that the configuration seems to be correct however the switch does not show up anywhere (entities and dev tools). I’ve already restarted HA several times.

Below is my configuration.yaml


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

switch:
  - platform: rest
    name: "Shelly 1 Control"
    scan_interval: 5
    resource: http://192.168.5.151/relay/0
    body_on: 'turn=on'
    body_off: 'turn=off'
    is_on_template: '{{ value_json.ison == true }}'
    headers:
      content-type: application/x-www-form-urlencoded
    username: MY_USERNAME
    password: MY_PASSWORD

Am I doing something wrong?

Thanks in advance for any help :slight_smile:

Welcome to the community! Are you getting configuration check errors? Are there errors in the logs? Have you found these items yet?

Shelly can use MQTT and there is an Shelly intergration, ShellyForHass which might be easier

1 Like

Never mind. I’ve already solved it, it’s just me that I’m really really dumb :slight_smile:!!

At work I usually use IPs in the 192.168.5.x range, but not at home, so I should blame it on muscle memory on writing IPs :slight_smile:

Sorry for creating a topic because I’m dumb.

I’ve tried to use ShellyForHass, It worked on first try. But after a restart of HA, I lost control over the Shelly and didn’t manage to get it to work again.

So in order to prevent this happening again I thought it would be more resilient if I wrote the code my self.

Sure. Have you tried MQTT, you won’t need to poll it every 5 seconds then ?

I should do that next then :slight_smile: I’m more than happy to learn and figure out the best approach.

It’s fairly straighforward, setup a MQTT broker (if you haven’t already), enable MQTT in the shelly webpage (not the phone app), and setup a template switch/light.

Or maybe try this:

1 Like