Git Product home page Git Product logo

esphome_syslog's Introduction

esphome_syslog

A simple syslog component for esphome. The component is designed to auto attach itself to the logger core module (like the MQTT component does with the log_topic)

This component uses the https://github.com/arcao/Syslog library version 2.0 at its core

How to

Manually

To install, locate your esphome folder, create a folder named custom_components got into it and execute 

git clone https://github.com/TheStaticTurtle/esphome_syslog.git
mv esphome_syslog/components/syslog .
rm -rf esphome_syslog

YAML

external_components:
  - source: github://TheStaticTurtle/esphome_syslog
    components: [syslog]

Configuration

Simply add this to the configuration of your esphome node: 

syslog:

When used like this, the component will simply broadcast its log to everyone on the network to change this behavior you can add the ip_address and port option like this:

syslog:
    ip_address: "192.168.1.53"
    port: 514

Default behavior strips the esphome color tags from the log (The 033[0;xxx and the #033[0m) if you do not want this set the strip_colors option to False.

Default behavior also sets enable_logger to True if you wish to disable sending logger messages and only use the syslog.log action you can do so by setting it to False:

The action syslog.log has 3 settings:

then:
    - syslog.log:
        level: 7
        tag: "custom_action"
        payload: "My log message"

Due to the differences in log levels of syslog and esphome I had to translate them, here is a table:

Esphome level                  Syslog level
ESPHOME_LOG_LEVEL_NONE          LOG_EMERG   
ESPHOME_LOG_LEVEL_ERROR        LOG_ERR     
ESPHOME_LOG_LEVEL_WARN          LOG_WARNING 
ESPHOME_LOG_LEVEL_INFO          LOG_INFO     
ESPHOME_LOG_LEVEL_CONFIG        LOG_NOTICE   
ESPHOME_LOG_LEVEL_DEBUG        LOG_DEBUG   
ESPHOME_LOG_LEVEL_VERBOSE      LOG_DEBUG   
ESPHOME_LOG_LEVEL_VERY_VERBOSE LOG_DEBUG   

This table is however open to discussion as it's my interpretation, if you want to change it you can do so in the syslog_component.cpp file and change the array at line 22

Warning

This component should not break anything and should work with everything however if it doesn't please open an issue. I have successfully tested this component with an esp8266 and an esp32. BUT The esp32 seems to have issue when there is a lot of thing to send very fast which you can see turing boot when it prints the config, see my comment in issue #7 for more details .

esphome_syslog's People

Contributors

thestaticturtle avatar leo-b avatar geiseri 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.