Giter Site home page Giter Site logo

mqttled's Introduction

MQTTLED

This package allows control of an OpenWRT device's LEDs over MQTT. Configured using UCI or YAML. No changes are made to the existing triggers. Uninstalling will revert to your normal LED triggers.

Config

Normal configuration is done through UCI. The configuration file is:

/etc/config/mqttled

The default configuration looks like this:

config mqtt 'mqtt'
    #MQTT Broker Address
    option host '192.168.1.1'
    option port '1883'
    #May work without this, should bind to all interfaces. Needs to be an interface matching in /etc/config/network
    option interface 'lan'
    option username ''
    option password ''
    #Not tested
    option tls '0'
    option cert ''
    option discovery 'homeassistant'
    #Set your topic here: e.g. OpenWRTleds/CustomDevice/led1
    option basetopic 'OpenWRTleds'
    option subtopic 'CustomDevice'
    #Reported in the 'device' page in Home Assistant
    option model 'OpenWRT Device'

config leds 'leds'
    #Setting this to 1 will ignore any includes
    option includeall '1'
    #excluded LEDs will allways be supressed
    list exclude 'mt76-phy0'
    list exclude 'rt2800soc-phy1::assoc'
    list exclude 'rt2800soc-phy1::quality'
    list exclude 'rt2800soc-phy1::radio'
    #list include 'blue:internet'

config rgb 'rgb'
    # Exposes 3 LEDs to HomeAssistant as a single RGB LED
    option enablergb '0'
    # The name of the RGB LED to expose to HomeAssistant
    option name 'RGB'
    # The IDs of the three colored LEDs
    option red 'LED0_Red'
    option green 'LED0_Green'
    option blue 'LED0_Blue'


config trigger 'triggers'
    #Only triggers listed here will be presented to HA as 'effects'
    list triggers 'none'
    list triggers 'default-on'
    list triggers 'heartbeat'
    list triggers 'timer'

Changes should be made either with UCI e.g.

uci set mqttled.mqtt.host='192.168.1.254'
uci commit

or by editing the config file directly. You will then need to restart the service with

service mqttled restart

Info

Topics

This service will publish a retained message to the discoverytopic/light on start. This will point Homeassistant to the state and availability topics of your device set under basetopic/subtopic. The current state is reported on basetopic/subtopic/ledname/state. The daemon is subscribed to basetopic/subtopic/ledname/set for commands.

Attributes

The mqttled service will expose the LEDs as dimmable using the value set under /sys/class/leds/led#/brightness.

Local Changes

Changes made to LED state on the device are not polled. i.e. any changes you make to the LED states by any other means will not be reflected unless the service is restarted.

mqttled's People

Contributors

trevortrevor avatar smallpepperz avatar

Stargazers

 avatar Keith T. Garner avatar

Watchers

 avatar

Forkers

smallpepperz

mqttled's Issues

LuCI Interface

Ideally, LED configuration could be done via the web UI.

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.