Documentation ¶
Index ¶
- Constants
- func ConnectNhc(cfg *config.NhcConf) (conn *net.TCPConn, err error)
- func CreateJeedomCMD(cmd interface{}) (i string, err error)
- func CreateJeedomEquipment(locID, name string) (i string, err error)
- func CreateJeedomObject(name string) error
- func Discover() net.IP
- func ExecJeedomRPCRequest(args *types.JsonRpcArgs) (res []byte, err error)
- func GetJeedomCMDs(id string) []types.JeedomCMD
- func GetJeedomEquipments() []types.JeedomEquipment
- func GetJeedomObjects() []types.JeedomLocation
- func GetNhcInfo(w http.ResponseWriter, r *http.Request)
- func GetNhcItem(w http.ResponseWriter, r *http.Request)
- func GetNhcItems(w http.ResponseWriter, r *http.Request)
- func GetOutboundIP() net.IP
- func Health(w http.ResponseWriter, r *http.Request)
- func JeedomCmd(w http.ResponseWriter, r *http.Request)
- func JeedomInit()
- func NhcCmd(w http.ResponseWriter, r *http.Request)
- func NhcInit(cfg *config.NhcConf)
- func NhcListener()
- func Route(msg *types.Message)
- func SendCommand(cmd string) error
- func ServeWebSocket(w http.ResponseWriter, r *http.Request)
- func Start(conf string)
- func UpdateJeedomState(item types.NHCItem) error
- type ClientPool
- type Server
- type SimpleCmd
- type WSClient
Constants ¶
const ( // SystemInfo holds NHC startevents SystemInfo = "{\"cmd\":\"systeminfo\"}" // RegisterCMD holds NHC startevents RegisterCMD = "{\"cmd\":\"startevents\"}" // ListActions holds NHC listactions ListActions = "{\"cmd\":\"listactions\"}" // ListLocations holds NHC listlocations ListLocations = "{\"cmd\":\"listlocations\"}" // ListEnergies holds NHC listenergy ListEnergies = "{\"cmd\":\"listenergy\"}" // ListThermostats holds NHC listthermostat ListThermostats = "{\"cmd\":\"listthermostat\"}" )
const HealthMsg = `{"alive":true}`
HealthMsg static alive json for health endpoint
Variables ¶
This section is empty.
Functions ¶
func ConnectNhc ¶ added in v0.3.0
ConnectNhc establish connection to Niko Home Control IP module
func CreateJeedomCMD ¶ added in v0.4.0
CreateJeedomCMD creates a cmd to a Jeedom script equipment
func CreateJeedomEquipment ¶ added in v0.4.0
CreateJeedomEquipment saves a new script equipment to jeedom
func CreateJeedomObject ¶ added in v0.4.0
CreateJeedomObject saves the object to jeedom (location)
func Discover ¶ added in v0.3.0
Discover discover NHC controller by sending UDP pkg on port 10000 return NHC IP address and boolean
func ExecJeedomRPCRequest ¶ added in v0.4.0
func ExecJeedomRPCRequest(args *types.JsonRpcArgs) (res []byte, err error)
ExecJeedomRPCRequest send JSON RPC request to Jeedom, returns raw result
func GetJeedomCMDs ¶ added in v0.3.0
GetJeedomCMDs returns the list of cmds of a given equipment
func GetJeedomEquipments ¶ added in v0.3.0
func GetJeedomEquipments() []types.JeedomEquipment
GetJeedomEquipments list all Jeedom script equipments
func GetJeedomObjects ¶ added in v0.3.0
func GetJeedomObjects() []types.JeedomLocation
GetJeedomObjects gets all objects from Jeedom
func GetNhcInfo ¶ added in v0.3.0
func GetNhcInfo(w http.ResponseWriter, r *http.Request)
GetNhcInfo handler for /api/v1/nhc/
func GetNhcItem ¶ added in v0.3.0
func GetNhcItem(w http.ResponseWriter, r *http.Request)
GetNhcItem handler for /api/v1/nhc/{id}
func GetNhcItems ¶ added in v0.3.0
func GetNhcItems(w http.ResponseWriter, r *http.Request)
GetNhcItems handler for /api/v1/nhc/
func GetOutboundIP ¶ added in v0.3.0
GetOutboundIP returns the IP address used for out access
func Health ¶
func Health(w http.ResponseWriter, r *http.Request)
Health endpoint for health monitoring
func JeedomCmd ¶ added in v0.3.0
func JeedomCmd(w http.ResponseWriter, r *http.Request)
JeedomCmd handler for POST on /jeedom/{id}/{value}
func NhcCmd ¶ added in v0.3.0
func NhcCmd(w http.ResponseWriter, r *http.Request)
NhcCmd endpoints for sending NHC commands
func NhcListener ¶ added in v0.3.0
func NhcListener()
NhcListener start a connection to nhc host, register itself to receive and route all messages from nhc broadcast
func SendCommand ¶ added in v0.3.0
SendCommand send passed command to nhc
func ServeWebSocket ¶ added in v0.3.0
func ServeWebSocket(w http.ResponseWriter, r *http.Request)
ServeWebSocket called by the http endpoint. Calls serveWS function and adds the WSPool to original connection
func UpdateJeedomState ¶ added in v0.3.0
UpdateJeedomState updates the device's status in Jeedom
Types ¶
type ClientPool ¶ added in v0.3.0
type ClientPool struct { // Broadcast Inbound messages from the clients. Broadcast chan []byte // Unregister requests from clients. Unregister chan *WSClient // contains filtered or unexported fields }
ClientPool maintains the set of active clients and broadcasts messages to the clients. Use the Broadcast channel to push msg to all clients
var ( // WSPool instance to hold ClientPool WSPool *ClientPool )
func (*ClientPool) Run ¶ added in v0.3.0
func (cp *ClientPool) Run()
Run activates the ClientPool so that we can manage client connections
type Server ¶
Server holds the gomotics app definition
func (*Server) Initialize ¶
func (s *Server) Initialize()
Initialize initialize the server also calls the internal in mem db