Today I would like to show you in the form of a mini guide how to easily add practically any Shelly device to Home Assistant.
We will use an add-on for this purpose ShellyForHASS.
Advantages of the ShellyForHASS add-on
On the add-on page, the author presents a number of advantages of his integration:
- Automatic Shelly detection in the local network (you can disable this option).
- Predefined states, sensors (energy, power, temperature) and attributes (rssi, ip, battery status) depending on the Shelly model.
- Control by means of services (on / off / dim / close / open).
- Predefined events e.g. click, multiple click etc.
- No additional Shelly configuration is required for operation, it only needs to be on the local network.
- It works locally, you don't have to add Shelly to the cloud, but it also works if you added it.
- Uses CoAP and REST protocols embedded in Shelly.
- Communication without delays.
- Works parallel to MQTT if you set them up
- Shelly modules do not need to have a static IP.
- Large configuration options from the Home Assistant level.
- It supports a proxy to connect Shelly with other LANs.
- Provides a sensor that indicates when the Shelly module has a new software update available.
- If we provide data to the cloud, it may download the names of the modules that we have defined earlier in the application.
Adding Shelly modules to the local network
Adding Shelly to the local network is described in the article below. I will copy the fragment that interests us.
Description applies to Shelly 2.5, but the other modules are added in the same way:
- We connect Shelly 2.5 according to the wiring diagram. In our case, it will be the upper left diagram. If it has not been previously configured, the red LED under the RESET button should flash. If it is not flashing, hold the RESET button for 5 seconds.
- We search for a new unsecured Wi-Fi network on the computer with a name that begins with "shellyswitch ..." and connect to it.
- We open a web browser and enter the configuration page of our Shelly http://192.168.33.1
- Go to Internet & Security -> WIFI MODE - CLIENT, activate “Connect the Shelly device to an existing WiFi Network "and enter the network data of our router (necessarily 2,4 GHz subnets).
- We decide whether we want to use Shelly 2.5 as relays or to control blinds / curtain rods. For blinds / curtain rods, set the following option:
Optional (without this ShellyForHASS will also work):
- In order for the device to always receive the same IP address in the local seat, check "Set static IP address" and fill in the fields. However, check in advance on the router's configuration page which IP address is still available. Suppose we set the address: 192.168.1.60.
- After saving changes, Shelly 2.5 will no longer be available at http://192.168.33.1. The WiFi network we have temporarily used will also disappear. Now enter the previously set IP address in your web browser. In our case, http://192.168.1.60
- Then update the Shelly 2.5 software.
Installation of ShellyForHASS
- By using an add-on HACS
A simpler way. If we already have HACS, which serves, among others for installation of unofficial Home Assistant integration, we can use it.
In the HACS search engine we search for "Shelly", select the ShellyForHASS add-on and click Install.
- Manual method
Download the latest package from page, extract the files and copy them to the folder:
Where should the custom_component folder be located, how to create it and how to copy files to it, you will learn from the article below:
Adding Shelly modules to Home Assistant
Now you only need to add the following line of code to the configuration.yaml file:
This will find and add all Shelly modules in our local network with the default parameter values that the add-on offers. If you want to configure something more, e.g. give your modules names or make the Shelly 2.5 switch visible as lighting instead of a switch, use the additional lines of code that you can read directly on the add-on page: https://github.com/StyraHem/ShellyForHASS
For example, my code in configuration.yaml looks like this:
id ties in with the name of a specific Shelly. First I put the "shelly:" in the configuration and reset the Home Assistant. This way the add-on found all my Shelly id's I could later look at in "Developer Tools" in the Home Assistant menu.