/natureremo

Nature Remo API Client for Go

Primary LanguageGoMIT LicenseMIT

Nature Remo API Client for Go Go ReferenceGo Report Card

tenntenn/natureremo is Nature Remo API Client for Go. Nature Remo is a smart remote control that easily realizes smart home by connecting your appliances to the Internet.

Install

$ go get -u github.com/tenntenn/natureremo

Examples

See _example directory.

func main() {
	cli := natureremo.NewClient(os.Args[1])
	ctx := context.Background()

	applianceName := os.Args[2]
	signalName := os.Args[3]

	as, err := cli.ApplianceService.GetAll(ctx)
	if err != nil {
		log.Fatal(err)
	}

	var target *natureremo.Appliance
	for _, a := range as {
		if a.Nickname == applianceName {
			target = a
			break
		}
	}

	if target == nil {
		log.Fatalf("%s not found", applianceName)
	}

	for _, s := range target.Signals {
		if s.Name == signalName {
			cli.SignalService.Send(ctx, s)
			break
		}
	}
}

Supported API

Cloud API

http://swagger.nature.global

Status Endpoint HTTP Method Service
✔️ /1/users/me GET UserService
✔️ /1/users/me POST UserService
✔️ /1/devices GET DeviceService
✔️ /1/devices/{device} POST DeviceService
✔️ /1/devices/{device}/delete POST DeviceService
✔️ /1/devices/{device}/temperature_offset POST DeviceService
✔️ /1/devices/{device}/humidity_offset POST DeviceService
✔️ /1/detectappliance POST ApplianceService
✔️ /1/appliances GET ApplianceService
✔️ /1/appliances POST ApplianceService
✔️ /1/appliance_orders POST ApplianceService
✔️ /1/appliances/{appliance}/delete POST ApplianceService
✔️ /1/appliances/{appliance} POST ApplianceService
✔️ /1/appliances/{appliance}/aircon_settings POST ApplianceService
✔️ /1/appliances/{appliance}/tv POST ApplianceService
✔️ /1/appliances/{appliance}/light POST ApplianceService
✔️ /1/appliances/{appliance}/signals GET SignalService
✔️ /1/appliances/{appliance}/signals POST SignalService
✔️ /1/appliances/{appliance}/signal_orders POST SignalService
✔️ /1/signals/{signal} POST SignalService
✔️ /1/signals/{signal}/delete POST SignalService
✔️ /1/signals/{signal}/send POST SignalService

Local API

http://local.swagger.nature.global/

Status Endpoint HTTP Method LocalClient Method
✔️ /messages GET Fetch
✔️ /messages POST Emit