Documentation ¶
Overview ¶
Package shelly implements calls to a shelly unit using HTTP RPC
Index ¶
- func CreateSchedule(ctx context.Context, dest fmt.Stringer, s Schedule) error
- func CreateScheduleRefresherSchedule(ctx context.Context, dest fmt.Stringer, myPort int) error
- func DeleteAllSchedules(ctx context.Context, dest fmt.Stringer) error
- func DisableSchedules(ctx context.Context, dest fmt.Stringer, ids ...int) error
- func DoGet(ctx context.Context, dest fmt.Stringer, method string, ...) ([]byte, int, error)
- func DoRPCCall(ctx context.Context, dest fmt.Stringer, httpMethod, method string, ...) ([]byte, int, error)
- func EnableSchedules(ctx context.Context, dest fmt.Stringer, ids ...int) error
- func GetInputState(ctx context.Context, dest fmt.Stringer) (bool, error)
- func SetSwitch(ctx context.Context, dest fmt.Stringer, state State) error
- func TurnOff(ctx context.Context, dest fmt.Stringer) error
- func TurnOn(ctx context.Context, dest fmt.Stringer) error
- type Call
- type JobSpec
- type Schedule
- type Schedules
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateScheduleRefresherSchedule ¶
CreateScheduleRefresherSchedule will make sure that the schedules are refreshed every day @ 23.55
func DisableSchedules ¶
func DoRPCCall ¶
func DoRPCCall(ctx context.Context, dest fmt.Stringer, httpMethod, method string, options map[string]string, reqBody []byte) ([]byte, int, error)
DoRPCCall calls RPC endpoints towards the Shelly. Returns body (or nil if empty), http response code and an error
func EnableSchedules ¶
func GetInputState ¶
GetInputState returns true if the controller input is on, false otherwise
Types ¶
type Call ¶
type Call struct { Method string `json:"method"` Params map[string]interface{} `json:"params,omitempty"` }
Call is what the job should do
type JobSpec ¶
type JobSpec struct { Id int `json:"id,omitempty"` Enable bool `json:"enable"` Timespec string `json:"timespec"` Calls []Call `json:"calls"` }
JobSpec is a Shelly schedule trigger
type Schedule ¶
type Schedule struct {
Jobs Schedules `json:"jobs"`
}
Schedule is a top-level shelly schedule collection
func ShellySchedule ¶
ShellySchedule converts a schedule.Schedule to something a Shelly can understand.
Click to show internal directories.
Click to hide internal directories.