devices

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DevTypeModbusRtu ...
	DevTypeModbusRtu = DeviceType("modbus_rtu")
	// DevTypeModbusTcp ...
	DevTypeModbusTcp = DeviceType("modbus_tcp")

	// bit access
	ReadCoils = "ReadCoils"
	// ReadDiscreteInputs ...
	ReadDiscreteInputs = "ReadDiscreteInputs"
	// WriteSingleCoil ...
	WriteSingleCoil = "WriteSingleCoil"
	// WriteMultipleCoils ...
	WriteMultipleCoils = "WriteMultipleCoils"

	// 16-bit access
	ReadInputRegisters = "ReadInputRegisters"
	// ReadHoldingRegisters ...
	ReadHoldingRegisters = "ReadHoldingRegisters"
	// ReadWriteMultipleRegisters ...
	ReadWriteMultipleRegisters = "ReadWriteMultipleRegisters"
	// WriteSingleRegister ...
	WriteSingleRegister = "WriteSingleRegister"
	// WriteMultipleRegisters ...
	WriteMultipleRegisters = "WriteMultipleRegisters"
)
View Source
const (
	// DevTypeCommand ...
	DevTypeCommand = DeviceType("command")
)
View Source
const (
	// DevTypeDefault ...
	DevTypeDefault = DeviceType("default")
)
View Source
const (
	// DevTypeMqtt ...
	DevTypeMqtt = DeviceType("mqtt")
)
View Source
const (
	// DevTypeSmartBus ...
	DevTypeSmartBus = DeviceType("smartbus")
)
View Source
const (
	// DevTypeZigbee2mqtt ...
	DevTypeZigbee2mqtt = DeviceType("zigbee2mqtt")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse struct {
	Error string  `json:"error"`
	Time  float64 `json:"time"`
}

BaseResponse ...

type DevCommandConfig

type DevCommandConfig struct {
	Validation
}

DevCommandConfig ...

type DevCommandRequest

type DevCommandRequest struct {
	Name string   `json:"name"`
	Args []string `json:"args"`
}

DevCommandRequest ...

type DevCommandResponse

type DevCommandResponse struct {
	BaseResponse
	Result string `json:"result"`
}

DevCommandResponse ...

type DevModBusRequest

type DevModBusRequest struct {
	Function string   `json:"function"`
	Address  uint16   `json:"address"`
	Count    uint16   `json:"count"`
	Command  []uint16 `json:"command"`
}

DevModBusRequest ...

type DevModBusResponse

type DevModBusResponse struct {
	BaseResponse
	Result []uint16 `json:"result"`
}

params: result error time

type DevModBusRtuConfig added in v0.0.19

type DevModBusRtuConfig struct {
	Validation
	SlaveId  int    `json:"slave_id" mapstructure:"slave_id"`   // 1-32
	Baud     int    `json:"baud"`                               // 9600, 19200, ...
	DataBits int    `json:"data_bits" mapstructure:"data_bits"` // 5-9
	StopBits int    `json:"stop_bits" mapstructure:"stop_bits"` // 1, 2
	Parity   string `json:"parity"`                             // none, odd, even
	Timeout  int    `json:"timeout"`                            // milliseconds
}

DevModBusRtuConfig ...

type DevModBusTcpConfig added in v0.0.19

type DevModBusTcpConfig struct {
	Validation
	SlaveId     int    `json:"slave_id" mapstructure:"slave_id"`
	AddressPort string `json:"address_port" mapstructure:"address_port"`
}

DevModBusTcpConfig ...

type DevMqttConfig added in v0.0.19

type DevMqttConfig struct {
	Validation
	Address string `json:"address"`
}

DevMqttConfig ...

type DevMqttRequest added in v0.0.19

type DevMqttRequest struct {
	Topic   string `json:"topic"`
	Payload []byte `json:"payload"`
	Qos     uint8  `json:"qos"`
	Retain  bool   `json:"retain"`
}

DevMqttRequest ...

type DevMqttResponse added in v0.2.0

type DevMqttResponse struct {
	BaseResponse
}

params: result error time

type DevSmartBusConfig

type DevSmartBusConfig struct {
	Validation
	Baud     int `json:"baud" valid:"Required"`
	Device   int `json:"device"`
	Timeout  int `json:"timeout" valid:"Required"`
	StopBits int `json:"stop_bits" valid:"Required" mapstructure:"stop_bits"`
	Sleep    int `json:"sleep"`
}

DevSmartBusConfig ...

type DevSmartBusRequest

type DevSmartBusRequest struct {
	Command []byte `json:"command"`
}

DevSmartBusRequest ...

type DevSmartBusResponse

type DevSmartBusResponse struct {
	BaseResponse
	Result []byte `json:"result"`
}

DevSmartBusResponse ...

type DevZigbee2mqttConfig added in v0.2.0

type DevZigbee2mqttConfig struct {
	Validation
	Zigbee2mqttDeviceId string `json:"zigbee2mqtt_device_id"`
}

DevZigbee2mqttConfig ...

type DevZigbee2mqttRequest added in v0.2.0

type DevZigbee2mqttRequest struct {
	Path    string `json:"path"`
	Payload []byte `json:"payload"`
}

DevZigbee2mqttRequest ...

type DevZigbee2mqttResponse added in v0.2.0

type DevZigbee2mqttResponse struct {
	BaseResponse
}

params: result error time

type ModBusBind added in v0.2.0

type ModBusBind struct {
	F              string
	Address, Count uint16
	Command        []uint16
}

ModBusBind ...

func NewModBusBind added in v0.2.0

func NewModBusBind(f string, address, count uint16, command []uint16) ModBusBind

Javascript Binding

ModBus(func, address, count, command)

type MqttBind added in v0.2.0

type MqttBind struct {
	Path    string
	Payload []byte
}

MqttBind ...

func NewMqttBind added in v0.2.0

func NewMqttBind(path, payload string) MqttBind

Javascript Binding

Mqtt(path, payload)

type RunCommandBind added in v0.2.0

type RunCommandBind struct {
	Name string
	Args []string
}

RunCommandBind ...

func NewRunCommandBind added in v0.2.0

func NewRunCommandBind(name string, args []string) RunCommandBind

Javascript Binding

RunCommand(name, args)

type Zigbee2mqttBind added in v0.2.0

type Zigbee2mqttBind struct {
	Path    string
	Payload []byte
}

Zigbee2mqttBind ...

func NewZigbee2mqttBind added in v0.2.0

func NewZigbee2mqttBind(path string, payload string) Zigbee2mqttBind

Javascript Binding

Zigbee2mqtt(path, payload)

Jump to

Keyboard shortcuts

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