How to add Shelley devices to HA?

If someone uses one file configuration it looks like this:

# in configuration.yaml file
automation:
  - id: first_automation_rule
    ...
  - id: second_automation_rule
    ...

You use multiple files configuration so it should looks like this:

# in configuration.yaml file
automation: !include automations.yaml

# in automations.yaml file
- id: first_automation_rule
  ...
- id: second_automation_rule
  ...

If you have troubles with YAML you can use automation editor in UI to add this automation.

ad2: should be removed

Not wishing to derail the thread, I personally find the custom component ShellyForHass https://github.com/StyraHem/ShellyForHASS much more straightforward for integrating Shelly devices. Just install with HACS, add

shelly:

to configuration.yaml and restart Home Assistant.

Then, all Shelly devices will show up automatically. Search for shelly under Configuration/Devices from the frontend, and you’ll see them. If you add more Shelly devices to your WiFi network, they’ll show up automatically the same way. You don’t have to restart HA again.

You also don’t need to configure MQTT in the Shelly settings, nor do you need to have the cloud enabled. But you can have both of those enabled for other purposes if you’d like.

1 Like

The weak point of SHellyForHASS integration is that it creates sensors/switches controlled by REST API which is less sufficient comparing to MQTT. I wish it will help with mqtt.

I still suggest to use manually configured mqtt switches/sensors. I’m curious how many hours more guys will spend with integration which is intended to save time.

Just out of curiosity, what makes sufficiency (efficiency?) important in this case? I don’t notice any latency that may be due to using the REST API, and the impact on WiFi traffic must be minimal. Is there an important point that I’m missing? Cheers.

The fact you don’t notice latency doesn’t mean it may not exist. Also it should be obvious that polling data with some frequency, getting the same values at most time is waste of resources.
Of course it doesn’t mean you will experience delays or it will affect you in any other way. It’s just suboptimal approach: anti-pattern

Using data gateway pattern (mqtt) makes system easier to maintain and secure.
In REST approach a controller (application) needs to maintain addresses of all known devices. In MQTT approach all devices work with one, the same MQTT server. Isn’t it less complex and easier to maintain?

Likely there are more reasons. I have no doubt gateway pattern has cons too. For sure you can find discussion about it on this forum or over Internet.

Yeah!

It seems that (with all your help) I finally managed to get the plumbing right.

That is, I don’t see any notifications and I do see lot’s of Shelly stuff at the configTab.

But it’s not quite right yet……

In the log however I see three SyncWorker-errors

2020-03-10 20:01:30 ERROR (SyncWorker_12) [homeassistant.components.python_script.shellies_discovery.py] []

2020-03-10 20:01:30 ERROR (SyncWorker_1) [homeassistant.components.python_script.shellies_discovery.py] []

2020-03-10 20:01:30 ERROR (SyncWorker_11) [homeassistant.components.python_script.shellies_discovery.py] []

And I also see a bunch of exclamation marks in the entities-subTab.

So still work to do, but first I have a drink on this nice intermediate result.

After that I am going to try to implement a few simple use cases with MQTT, automations, scripts and scenes. First case: switch all my three devices simultaneous on / off after receiving an on/off message via the broker sent by a remote Rpi.

Any clues regarding the logErrors and exclamation marks?

These errors in log are my small mistake. Update the script.

I changed nothing, just restarted HA.

The overview is changed, looking better and I now am able to control my devices from “the dashboard”, witch is pretty cool! I guess an extra reboot was needed to complete the configuration.

Errors in the log are still there.

Do I understand that you are updating the script for this?

I just paid you a cup of coffee.
Ko

Yes, HA restart is necessary (or manually run announce automation). There is information about this in documentation. Thanks for the coffee!

I run HassIO, latest updates,

I also have HACS installed and ShellyForHass (Shelly integration)

Some of my shelly devices have been flashed with Tasmota, others are running out of the box.

Stock Shelly devices are two H&T, plus a Shelly1 that I’m using to control my electric water heater.

Chris