Skip to content

alex-savin/hassky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hassky

Is a simple API client to interact with Home Assistant instance (https://www.home-assistant.io/) via HTTP(s) / Websocket, written in Go

News

  • v0.0.1-dev First public release on May 6, 2020

Features

  • Simple and chainable methods for settings and request

Installation

# Go Modules
require github.com/alex-savin/hassky

Usage

The following samples will assist you to become as comfortable as possible with hassky library.

// Import hassky into your code and refer it as `hassky`.
import "github.com/alex-savin/hassky"

Simple PING request

// Create a Hassky Client
h, _ := hassky.New("[HASS-IP-ADDESS]:[PORT]", "[HASS-API-TOKEN]", "[USE-SSL]", "[LOG-LEVEL]")

h.R().Ping().
      Exec()

Simple CALL SERVICE request

h.R().CallService("light.toggle", "light.porch_01").
      Exec()

Advanced CALL SERVICE request

h.R().CallService("light.toggle", "light.porch_01").
      SetParameters(map[string]interface{}{
        "transition":15,
        "brightness_pct":100
      }).
      Exec()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages