Giter Club home page Giter Club logo

homeassistant-mysql_command's Introduction

HACS Custom GitHub Latest Release GitHub All Releases Community Forum

MySQL Command

A Home Assistant custom component that creates a notify service to send a command to a MySQL server.

Forum Topic: https://community.home-assistant.io/t/mysql-command/539839

Features

  • Send commands to a MySQL server using the Notify platform / service

Installation

Using HACS

This component can be installed using HACS. Please follow directions here and use https://github.com/qrioniclabs/homeassistant-mysql_command as the repository URL.

Manual

  • Copy directory custom_components/mysql_command to your <config dir>/custom_components directory
  • Configure with config below
  • Restart Home Assistant

Configuration

YAML

In configuration.yaml:

notify:
  - name: mysql_command_example_db
    platform: mysql_command
    host: YourHostnameOrIP
    username: YourUser
    password: YourPassword
    db: YourDB

Then, use the service like so:

- service: notify.mysql_command_example_db
      data_template:
        message: >
          INSERT INTO `table` (column1, column2, column3) VALUES ('value1', 'value2', 'value3');

Here is an example with a template timestamp:

- service: notify.mysql_command_example_db
      data_template:
        message: >
          INSERT INTO `table` (datetime, column1, column2) VALUES ('{{ now().timestamp() | timestamp_custom('%Y-%m-%d %H:%M:%S') }}', 'value1', 'value2');

Available configuration parameters

Key Type Required Value Description
platform string true mysql_command Name of a platform
host string true 192.168.1.123 Hostname or IP address of MySQL server
username string true example_user MySQL user with access to the database
password string true aVerySecretPassword Password for the MySQL user
db string true example_db The database that the command is sent to
port int false 3307 The TCP/IP port of the MySQL server. Default: 3306
timeout int false 30 Timeout (in seconds) for the database connection. Default: 10

Special thanks

homeassistant-mysql_command's People

Contributors

qrioniclabs avatar clau-bucur 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.