Giter VIP home page Giter VIP logo

ha-shellies-discovery's Introduction

Shellies Discovery

GitHub Release hacs_badge Community Forum

Screenshot

This script adds MQTT discovery support for Shellies in the Home Assistant.

This script use Home Assistant python_script component and you have to add it to your configuration.yaml file:

python_script:

You can install this script via HACS or just download shellies_discovery.py file and save it in /config/python_scripts folder.

After installing the script and adding automations, run Shellies Announce automation or restart Home Assistant twice.

Go to HA community for support and help.

Supported devices:

  • Shelly1
  • Shelly1PM
  • Shelly2 (relays and roller mode)
  • Shelly2.5 (relays and roller mode)
  • Shelly4Pro
  • Shelly Plug
  • Shelly Plug S
  • Shelly RGBW2 (color and white mode)
  • Shelly Bulb
  • Shelly H&T (with or without USB adapter)
  • Shelly Smoke
  • Shelly Sense
  • ShellyEM
  • Shelly Flood

Troubleshooting checklist

  • correct MQTT configuration in Home Assistant with discovery enabled
  • same discovery_prefix in Home Assistant configuration and in script configuration
  • Shellies firmware updated to current version
  • Home Assistant updated to current version
  • default topics configuration in Shellies

Minimal configuration

python_script:

automation:
  - id: shellies_announce
    alias: 'Shellies Announce'
    trigger:
      - platform: homeassistant
        event: start
    action:
      service: mqtt.publish
      data:
        topic: shellies/command
        payload: announce

  - id: 'shellies_discovery'
    alias: 'Shellies Discovery'
    trigger:
      - platform: mqtt
        topic: shellies/announce
    action:
      service: python_script.shellies_discovery
      data_template:
        id: '{{ trigger.payload_json.id }}'
        mac: '{{ trigger.payload_json.mac }}'
        fw_ver: '{{ trigger.payload_json.fw_ver }}'

Custom configuration example

python_script:

automation:
  - id: shellies_announce
    alias: 'Shellies Announce'
    trigger:
      - platform: homeassistant
        event: start
    action:
      service: mqtt.publish
      data:
        topic: shellies/command
        payload: announce

  - id: 'shellies_discovery'
    alias: 'Shellies Discovery'
    trigger:
      - platform: mqtt
        topic: shellies/announce
    action:
      service: python_script.shellies_discovery
      data_template:
        id: '{{ trigger.payload_json.id }}'
        mac: '{{ trigger.payload_json.mac }}'
        fw_ver: '{{ trigger.payload_json.fw_ver }}'
        discovery_prefix: 'hass'
        temp_unit: 'F'
        qos: 2
        shelly1-001122-relay-0: 'light'
        shellyswitch-9900AA-relay-0: 'light'
        shellyswitch-9900AA-relay-1: 'fan'
        shellyswitch25-334411-relay-1: 'light'
        shellyswitch-334455: 'cover'
        shellyrgbw2-AABB22: 'white'
        shellyrgbw2-CC2211: 'rgbw'
        shellyht-2200AA: 'ac_power'

Script arguments

key optional type default description
discovery_prefix True string homeassistant MQTT discovery prefix
temp_unit True string C temperature unit, C for Celsius, F for Farenhait
qos True integer 0 MQTT QoS, you can use 0, 1 or 2
relay_id/shelly_id True string switch HA component to use with relay_id, for example: shelly1-001122-relay-0: 'light' means that relay 0 of shelly1-001122 will use light component in HA. You can use switch, light or fan. For Shelly2 and Shelly2.5 you can use shellyswitch-334455: 'cover' for roller mode. For ShellyRGBW2 you can use shellyrgbw2-AABB22: 'white' for wite mode.

Buy Me A Coffee

ha-shellies-discovery's People

Contributors

bieniu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.