Giter Site home page Giter Site logo

lnxlink's Introduction

LNX Link is a Linux service for integrating your system with an external application like Home Assistant using MQTT. It is inspired by IOT Link.

Features

  • System control: Shutdown, Send Keys, Notify, Media.
  • System monitor: CPU, Ram, Network, Media.
  • No sudo required: No need to be root user to install and use.
  • Easily expanded: Any new module is automatically imported as long as it meets the required format.

Installation

One command install:

bash <(curl -s "https://raw.githubusercontent.com/bkbilly/lnxlink/master/install.sh")

You can manually update the configuration file /opt/lnxlink/config.yaml and restart the service with the use of systemctl:

systemctl --user restart lnxlink.service

Home Assistant integration

LNX Link is using MQTT Autodiscovery to create entities to the frontend.

Supported entities:

  • switch.shutdown
  • sensor.cpu_usage
  • sensor.memory_usage
  • sensor.network_download
  • sensor.network_upload

Unsupported entities that need manual configuration:

Commands

  • Shutdown System
    • Topic: {prefix}/{clientId}/commands/shutdown
  • Send Keys
    • Topic: {prefix}/{clientId}/commands/send-keys
    • Payload Type: List or String
    • Payload: Each string can contain special keys '++', '+c'
  • Notify
    • Topic: {prefix}/{clientId}/commands/notify
    • Payload Type: JSON
    • Payload:
      • title: String
      • message: String
  • Media
    • Topic: {prefix}/{clientId}/commands/media/{media_action}
    • media_action:
      • volume_set: payload is integer or float with values 0-1 or 0-100
      • playpause
      • previous
      • next

Monitoring

  • Power status
    • Topic: {prefix}/{clientId}/lwt
    • Payload Type: ON/OFF {connectMsg}/{disconnectMsg}
  • CPU
    • Topic: {prefix}/{clientId}/{statsPrefix}/cpu/usage
    • Payload Type: Integer
  • Memory RAM
    • Topic: {prefix}/{clientId}/{statsPrefix}/memory/usage
    • Payload Type: Integer
  • Network
    • Topic: {prefix}/{clientId}/{statsPrefix}/network/0/speed
    • Payload Type: JSON Mbps
    • Example:: {"download": 0.8, "upload": 0.1}
  • Media
    • Topic: {prefix}/{clientId}/{statsPrefix}/media/info
    • Payload Type: JSON
    • Example:: {"title": "Hakuna Matata", "artist": "disney", "album": "", "status": "playing", "volume": 51, "playing": true}

Expanding

To expand the supported features, create a new python file on modules folder and use this template:

class Addon():
    service = 'example'
    name = 'Example'

    def startControl(self, topic, data):
        ''' topic is a list with all topics after commands '''
        print(topic, data)
    
    def getInfo(self):
        ''' Returns any type that can be converted to JSON '''
        return 15

lnxlink's People

Contributors

bkbilly avatar matthijsy 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.