Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new accessories, updated services #118

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions accessory/fan.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package accessory

import (
"github.com/brutella/hc/service"
)

type Fan struct {
*Accessory

Fan *service.Fan
}

// NewFan returns a fan accessory containing one fan service.
func NewFan(info Info) *Fan {
acc := Fan{}
acc.Accessory = New(info, TypeFan)
acc.Fan = service.NewFan()

acc.AddService(acc.Fan.Service)

return &acc
}

21 changes: 21 additions & 0 deletions accessory/heater_cooler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package accessory

import (
"github.com/brutella/hc/service"
)

type HeaterCooler struct {
*Accessory

HeaterCooler *service.HeaterCooler
}

// NewSwitch returns a heater which implements model.Heater.
func NewHeaterCooler(info Info) *HeaterCooler {
acc := HeaterCooler{}
acc.Accessory = New(info, TypeHeater)
acc.HeaterCooler = service.NewHeaterCooler()
acc.AddService(acc.HeaterCooler.Service)

return &acc
}
23 changes: 23 additions & 0 deletions accessory/window_covering.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package accessory

import (
"github.com/brutella/hc/service"
)

type WindowCovering struct {
*Accessory

WindowCovering *service.WindowCovering
}

// NewWindowCovering returns a WindowCovering which implements model.WindowCovering.
func NewWindowCovering(info Info) *WindowCovering {
acc := WindowCovering{}
acc.Accessory = New(info, TypeWindowCovering)

acc.WindowCovering = service.NewWindowCovering()

acc.AddService(acc.WindowCovering.Service)

return &acc
}
6 changes: 6 additions & 0 deletions service/heater_cooler.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// THIS FILE IS AUTO-GENERATED
// Modified by mestafin
package service

import (
Expand All @@ -14,6 +15,8 @@ type HeaterCooler struct {
CurrentHeaterCoolerState *characteristic.CurrentHeaterCoolerState
TargetHeaterCoolerState *characteristic.TargetHeaterCoolerState
CurrentTemperature *characteristic.CurrentTemperature

TargetTemperature *characteristic.TargetTemperature
}

func NewHeaterCooler() *HeaterCooler {
Expand All @@ -32,5 +35,8 @@ func NewHeaterCooler() *HeaterCooler {
svc.CurrentTemperature = characteristic.NewCurrentTemperature()
svc.AddCharacteristic(svc.CurrentTemperature.Characteristic)

svc.TargetTemperature = characteristic.NewTargetTemperature()
svc.AddCharacteristic(svc.TargetTemperature.Characteristic)

return &svc
}
5 changes: 5 additions & 0 deletions service/window_covering.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ type WindowCovering struct {
CurrentPosition *characteristic.CurrentPosition
TargetPosition *characteristic.TargetPosition
PositionState *characteristic.PositionState
//
HoldPosition *characteristic.HoldPosition
}

func NewWindowCovering() *WindowCovering {
Expand All @@ -28,5 +30,8 @@ func NewWindowCovering() *WindowCovering {
svc.PositionState = characteristic.NewPositionState()
svc.AddCharacteristic(svc.PositionState.Characteristic)

svc.HoldPosition = characteristic.NewHoldPosition()
svc.AddCharacteristic(svc.HoldPosition.Characteristic)

return &svc
}