homeassistant

package module
v0.0.0-...-599409c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 6 Imported by: 0

README

HomeAssistantAPI

Golang FastHTTP Client to interact with Home Assistnant

Documentation

Index

Constants

View Source
const (
	Sensor       = "sensor"
	BinarySensor = "binary_sensor"
	AlarmPanel   = "alarm_control_panel"
	Light        = "light"
	Switch       = "switch"
	Script       = "script"
)

Variables

View Source
var StatePath = "states/%s.%s"

Functions

This section is empty.

Types

type HomeAssistant

type HomeAssistant struct {
	URL string
	// contains filtered or unexported fields
}

HomeAssistant - main struct that the user will use

func NewHomeAssistant

func NewHomeAssistant(host string, port int, bearer string) (ha *HomeAssistant)

Creates Home Asisstnat object, initialize httpClient

func (*HomeAssistant) Connect

func (ha *HomeAssistant) Connect() error

Connect - Checks connection with HomeAssistant and its availability

func (*HomeAssistant) SendState

func (ha *HomeAssistant) SendState(sensorType string, entityId string, st StatePost) error

type StatePost

type StatePost struct {
	State      string `json:"state"`
	Attributes struct {
		FriendlyName string `json:"friendly_name"`
		UnitMeasure  string `json:"unit_of_measurement"`
	} `json:"attributes"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL