- Added ClimateApp to handle climate entity operations including turning on/off, adjusting temperature, and setting HVAC modes. - Implemented caching mechanism for climate entities to optimize state retrieval. - Created domain model for Climate with attributes such as current temperature, target temperature, and HVAC modes. - Developed unit tests for ClimateApp to ensure functionality and correctness. feat: add RemoteApp for SwitchBot commands - Introduced RemoteApp to facilitate sending commands to SwitchBot devices. - Implemented SendCommand method for executing device commands without state management. chore: update configuration for SwitchBot integration - Added SwitchBotToken and SwitchBotSecret to configuration for enabling SwitchBot Cloud commands. feat: define gRPC services for Climate and Remote operations - Created climate.proto and remote.proto files to define gRPC services for climate management and remote command execution. - Implemented corresponding request and response message structures for gRPC interactions.
25 lines
788 B
Go
25 lines
788 B
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitea.nik4nao.com/nik/home-services/ha-gateway/internal/core/ports/driven"
|
|
)
|
|
|
|
// RemoteApp is a thin passthrough to the SwitchBot driven port: SwitchBot
|
|
// custom IR buttons have no state to read back, so there is no discovery
|
|
// cache to maintain here, unlike LightApp/SwitchApp/ClimateApp.
|
|
type RemoteApp struct {
|
|
switchbot driven.SwitchBotClient
|
|
}
|
|
|
|
// NewRemoteApp constructs the remote application service.
|
|
func NewRemoteApp(switchbot driven.SwitchBotClient) *RemoteApp {
|
|
return &RemoteApp{switchbot: switchbot}
|
|
}
|
|
|
|
// SendCommand forwards one SwitchBot Cloud device command.
|
|
func (a *RemoteApp) SendCommand(ctx context.Context, deviceID, command, commandType string) error {
|
|
return a.switchbot.SendCommand(ctx, deviceID, command, commandType)
|
|
}
|