remove rheemcloud pkg, implement against rest api only
Build and Publish / helm-release (push) Has been skipped
Build and Publish / go-binaries (push) Has been skipped
Build and Publish / container-images (push) Has been skipped
Build and Publish / check-chart (push) Successful in 12s

This commit is contained in:
2026-07-05 16:59:53 -04:00
parent dcdf5e4230
commit 047f7c233d
15 changed files with 822 additions and 233 deletions
+11 -10
View File
@@ -12,9 +12,9 @@ import (
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/config"
)
// DefaultUsageInterval is used when UsageInterval is unset. Rheem's
// energy/water history only updates hourly, so polling faster is wasteful.
const DefaultUsageInterval = 5 * time.Minute
// DefaultPollInterval is used when PollInterval is unset. Each tick re-fetches
// device state and daily energy/water usage over REST.
const DefaultPollInterval = 1 * time.Minute
type ServiceConfig struct {
// Rheem EcoNet cloud credentials. Prefer supplying the password via
@@ -30,8 +30,9 @@ type ServiceConfig struct {
// metric from kWh energy usage.
CostPerKWH float64 `yaml:"costPerKWH" json:"costPerKWH,omitempty" env:"ECONET_COST_PER_KWH" default:"0.19"`
// UsageInterval controls how often energy/water usage history is polled.
UsageInterval time.Duration `yaml:"usageInterval" json:"usageInterval,omitempty" env:"ECONET_USAGE_INTERVAL"`
// PollInterval controls how often device state and daily energy/water
// usage are re-fetched over REST.
PollInterval time.Duration `yaml:"pollInterval" json:"pollInterval,omitempty" env:"ECONET_POLL_INTERVAL"`
// Embeds go-app config, used by go-app to
// merge custom config into go-app config, and to produce
@@ -50,10 +51,10 @@ func (c *ServiceConfig) LoadEnv() error {
return env.Parse(c)
}
// GetUsageInterval returns the configured usage poll interval or the default.
func (c *ServiceConfig) GetUsageInterval() time.Duration {
if c.UsageInterval <= 0 {
return DefaultUsageInterval
// GetPollInterval returns the configured poll interval or the default.
func (c *ServiceConfig) GetPollInterval() time.Duration {
if c.PollInterval <= 0 {
return DefaultPollInterval
}
return c.UsageInterval
return c.PollInterval
}