Giter VIP home page Giter VIP logo

homeassistant.ubusadvanced's Introduction

Home Assistant Ubus Advanced integration

Home Assistant device tracker which uses OpenWRT's ubus.

Installation

  • Install HACS - HACS Setup.
  • Add https://github.com/teddybeermaniac/HomeAssistant.UbusAdvanced repository to HACS - HACS Custom Repositories.
  • Install the integration using HACS.

Setup

On router

  • Create a /usr/share/rpcd/acl.d/homeassistant.json file. Adapt /tmp/dhcp.leases according to leasefile options in your /etc/config/dhcp configuration file (you can use wildcards here):
    {
        "homeassistant": {
            "description": "HomeAssistant Ubus Advanced integration",
            "read": {
                "file": {
                    "/tmp/dhcp.leases": [
                        "read"
                    ]
                },
                "ubus": {
                    "file": [
                        "read"
                    ],
                    "hostapd.*": [
                        "get_clients",
                        "get_status"
                    ],
                    "uci": [
                        "get"
                    ]
                },
                "uci": [
                    "dhcp"
                ]
            }
        }
    }
    See OpenWRT Wiki ubus/ACLs for more details.
  • Add /usr/share/rpcd/acl.d/homeassistant.json to /etc/sysupgrade.conf file to prevent it from being deleted during upgrade.
  • Add a section to /etc/config/rpcd. The password can be generated using uhttpd -m password:
    config login
            option username 'homeassistant'
            option password '$1$$I2o9Z7NcvQAKp7wyCTlia0'
            list read 'homeassistant'
            list write 'homeassistant'
    See OpenWRT Wiki ubus/Authentication for more details.
  • Restart rpcd /etc/init.d/rpcd restart.

In Home Assistant

  • Add device tracker to configuration.yaml. Use your router's IP, or hostname and username, and plaintext version of password that you added to /etc/config/rpcd:
    device_tracker:
      - platform: ubus_advanced
        host: http://192.168.0.1
        username: homeassistant
        password: password
        # Example options
        ssid_blacklist:
          - Guest WiFi
    See Home Assistant device_tracker for more details.

Configuration options

Name Required Default Description
host IP/Hostname of your router
username username from /etc/config/rpcd section
password Plaintext password from /etc/config/rpcd section
mac_blacklist [] Device MAC address blacklist
mac_whitelist [] Device MAC address whitelist
name_blacklist [] Device DHCP name blacklist (supports wildcards)
name_whitelist [] Device DHCP name whitelist (supports wildcards)
ssid_blacklist [] SSID blacklist
ssid_whitelist [] SSID whitelist
device_provider hostapd How to acquire device list. One of: hostapd
name_provider dnsmasq How to acquire device name mapping. One of: dnsmasq

Other common options can be found in Home Assistant device_tracker.

homeassistant.ubusadvanced's People

Contributors

teddybeermaniac avatar

homeassistant.ubusadvanced's Issues

Refactor code

Tasks:

  • Move code to custom_components/ubus_advanced directory.
  • Move code to subdirectories.
  • Add type hints.
  • Simplify imports.

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.