Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 7 additions & 4 deletions cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func configurableInstance[T any](typ string, conf *config.Config, newFromConf ne
}

var instance T
if err == nil {
if err == nil && !conf.Disable {
instance, err = newFromConf(ctx, typ, other)
if err != nil {
err = &DeviceError{cc.Name, fmt.Errorf("cannot create %s '%s': %w", typ, cc.Name, err)}
Expand Down Expand Up @@ -1338,9 +1338,12 @@ func configureLoadpoints(conf globalconfig.All) error {
return &DeviceError{cc.Name, err}
}

instance, err := core.NewLoadpointFromConfig(log, settings, static)
if err != nil {
err = &DeviceError{cc.Name, err}
var instance *core.Loadpoint
if !conf.Disable {
instance, err = core.NewLoadpointFromConfig(log, settings, static)
if err != nil {
err = &DeviceError{cc.Name, err}
}
}

dev := config.NewConfigurableDevice[loadpoint.API](&conf, instance)
Expand Down
1 change: 1 addition & 0 deletions util/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Config struct {

type Properties struct {
Type string
Disable bool `json:"deviceDisable,omitempty" mapstructure:"deviceDisable"`
Title string `json:"deviceTitle,omitempty" mapstructure:"deviceTitle"`
Icon string `json:"deviceIcon,omitempty" mapstructure:"deviceIcon"`
Product string `json:"deviceProduct,omitempty" mapstructure:"deviceProduct"`
Expand Down
Loading