DHCP vs static IPs

It is particularly fashionable among Shelly users to set static IPs for devices renouncing to DHCP (Dynamic Host Configuration Protocol); I personally don't entirely agree with this habit; below I explain why but if, for any reasons, you really want to do it, I also explain how to proceed.

Premise

It is always a good idea not to touch anything that works satisfactorily. DHCP is not an emanation of the devil. I swear.

When it makes sense to set static IP for devices

  1. Sometimes routers provided by the operators (ISP) have inadequate performance and cannot handle many devices at the same time; in this case it may be useful to reduce their workload by freeing them, at least partially, from the task of assigning addresses. Don't expect miracles though, the majority of the most common problems are due to weak WI-FI signal or interference, nothing to do with the assignment of addresses.
  2. Battery-operated devices that are not constantly connected, when configured with a static IP, can respond faster and use less energy.
  3. To control the devices via URL (for example with I/O Actions or Web Hooks) it is necessary to know their IP; also in this case it is convenient to assign them static IPs.
  4. If for any of the above reasons you need to set a static IP for one of your devices, it probably makes sense to do it for all of them.

Disadvantages

Using static IPs you renounced to some automatisms consequently it is necessary to manually configure some parameters. Errors and consequent headaches are just around the corner.

How to configure

Basically it is necessary to act on both routers and devices.
On the router side you need to exclude a range of addresses from the DHCP otherwise you could run into very annoying address conflicts. Each router can be configured this way, each in its own way, so don't ask me how. Instead, avoid the alternative method of address reservation because it produces a lot of clutter that is more difficult to manage manually. Reservation also doesn't completely eliminate the overhead the router experiences when it first sees a device.

On the devices side you have to check the static IP flag and edit:
  1. the IP address (unique and included in the range outside the DHC as defined above),
  2. the mask (usually 255.255.255.0),
  3. the gateway address (usually the router address),
  4. optionally the DNS address, if not edited the router will be used for the service therefore, if you decide to use a DNS not defined by the provider such as 1.1.1.1 or 8.8.8.8, it is preferable to configure the router accordingly rather than each individual device, which in any case can be done without problems.

Useful tools

A software such as Shelly Scanner can provide considerable help in defining the address plan.