Discover the IP of a Sonoff flashed Tasmota means Home Assistant

2 minutes of reading
Guide purposes:
  • Find out the IP address automatically assigned by the router to a Sonoff fresh from riproming
  • Difficulty level: bass
Concepts dealt with:
  • software installation and configuration
Software components used:
Prerequisites:
  • Wifi network connected to the Internet
  • Home Assistant configured and working
Physical devices used:
  • Computer with operating system Windows
  • Sonoff with ri firmwareproprogrammed
GUIDE more indicated for:

All environments

Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 1.1

Logo Home Assistant

Abstract

Subsequently to the reproming of a family device ITEAD Sonoff Smart Home (we have an example guide dedicated to the reprogrammation with firmware Sonoff-Tasmota) it is necessary, after the first start, to connect to it (typically via a web browser) for prosee the detailed configuration of its features.

First di prosee the flash of the new firmware (that is Sonoff-Tasmota, Espurna or other solutions) it is necessary to configure the connection coordinates to Wi-Fi (SSID and its password) so that, at the first start, the component provveda independently to connect to the network.

The connection usually involves, by the router, the assignment of a random IP address within the subnet provided on the network Wi-Fi same; to discover this IP in order to connect often, it is necessary to connect to the router, looking for the assigned address or use proad hoc grams to make a network scan.

Where the firmware used is Sonoff-Tasmota, Home Assistant it simplifies our life: with a simple setup of its configuration, it is possible to have a "sensor" that provides this information automatically.

Prerequisite

First to compile the firmware Sonoff-Tasmota to flash on the device, make sure you have filled in correctly, at the file "tasmota/my_user_config.h“, The fields relating to:

#define MQTT_HOST 
#define MQTT_USER
#define MQTT_PASS

with your broker's data MQTT.

Configuration

To obtain the result illustrated above, it is necessary, first of all, add the following in configuration script:

script:
 get_sonoff_ip:
  alias: Acquisizione automatica IP (sonoff)
  sequence:
  - data:
      topic: cmnd/sonoff/ipaddress
    service: mqtt.publish

Nb. If the file was modified before the firmware was compiled "config.h"Under the heading"PROJECT", The topic in configuration for this script will be changed accordingly.
In this example, the "PROJECT"Was left by default, or"sonoff"

Now an ad hoc "sensor" must be configured:

sensor:
 - platform: mqtt
    name: "SonOff IP"
    state_topic: 'stat/#'
    value_template: "{{ value_json.IPAddress1.split(' ')[1].replace('(','').replace(')','') }}"

Finally, it should be added in a "group"

group:
 sonoff:
    name: "Sonoff Tasmota"
    control: hidden
    entities:
      - sensor.sonoff_ip
      - script.get_gonoff_ip

Perform a restart now Home Assistant and then click on the script execution appena generated, obviously taking care to turn on, in advance, the Sonoff.

The IP address apparirà in dashboard.

inDomus telegram channel