Documentation
¶
Index ¶
- Variables
- type GeneratorConfig
- type MDNSConfig
- type MQTTConfig
- type Manager
- func (m *Manager) Get(name string) *Profile
- func (m *Manager) GetActive() *Profile
- func (m *Manager) GetActiveName() string
- func (m *Manager) InitEmbedded()
- func (m *Manager) List() []ProfileInfo
- func (m *Manager) ListByProtocol(protocol string) []ProfileInfo
- func (m *Manager) ListByProtocolAndCategory(protocol string, category string) []ProfileInfo
- func (m *Manager) LoadAll() error
- func (m *Manager) Save(profile *Profile) error
- func (m *Manager) SetActive(name string) error
- type OCPPConfig
- type Profile
- type ProfileInfo
Constants ¶
This section is empty.
Variables ¶
var EmbeddedProfiles = map[string]*Profile{ "sungrow-hybrid": { Name: "sungrow-hybrid", Description: "Sungrow SH Series Hybrid Inverter", Protocol: "modbus", DeviceType: "sungrow", Categories: []string{"pv", "battery", "meter", "grid", "control"}, EVCCRef: "https://github.com/evcc-io/evcc/blob/master/templates/definition/meter/sungrow-hybrid.yaml", ZapVerified: true, RegisterSetName: "sungrow", Defaults: map[uint16]float64{ 5016: 0, 13021: 0, 13022: 50, 5600: 0, 13052: 500, 13049: 0, 13050: 204, 13073: 10000, 33046: 500, 33047: 500, 5740: 230, 5741: 230, 5742: 230, 13019: 48, 13024: 25, 5007: 35, }, Generators: map[string]GeneratorConfig{ "solar_radiance": { Type: "daynight", Config: map[string]interface{}{ "peak_power": 5000.0, "sunrise_hour": 6.0, "sunset_hour": 20.0, }, }, "load": { Type: "schedule", Config: map[string]interface{}{ "base_load": 500.0, "schedule": []map[string]interface{}{ {"hour_start": 7, "hour_end": 9, "load": 2000}, {"hour_start": 17, "hour_end": 22, "load": 3000}, }, }, }, }, }, "solis-hybrid": { Name: "solis-hybrid", Description: "Solis Hybrid Inverter", Protocol: "modbus", DeviceType: "solis", Categories: []string{"pv", "battery", "meter", "grid", "control"}, ZapVerified: true, RegisterSetName: "solis", Defaults: map[uint16]float64{ 33057: 0, 33149: 0, 33139: 60, 33130: 0, 33147: 400, 33282: 50, 33093: 250, 33096: 250, 33251: 2300, 33253: 2300, 33255: 2300, }, }, "solaredge": { Name: "solaredge", Description: "SolarEdge Inverter with StorEdge", Protocol: "modbus", DeviceType: "solaredge", Categories: []string{"pv", "battery", "meter", "grid"}, EVCCRef: "https://github.com/evcc-io/evcc/blob/master/templates/definition/meter/solaredge.yaml", ZapVerified: true, RegisterSetName: "solaredge", Defaults: map[uint16]float64{ 40083: 0, 62852: 55, 62836: 0, 40206: 0, 40085: 5000, }, }, "sma-tripower": { Name: "sma-tripower", Description: "SMA Sunny Tripower Inverter", Protocol: "modbus", DeviceType: "sma", Categories: []string{"pv", "battery", "meter", "grid"}, EVCCRef: "https://github.com/evcc-io/evcc/blob/master/templates/definition/meter/sma-tripower.yaml", ZapVerified: true, RegisterSetName: "sma", Defaults: map[uint16]float64{ 30775: 0, 30845: 70, 30847: 0, 30865: 0, 30803: 50, }, }, "huawei-sun2000": { Name: "huawei-sun2000", Description: "Huawei SUN2000 Hybrid Inverter", Protocol: "modbus", DeviceType: "huawei", Categories: []string{"pv", "battery", "meter", "grid", "control"}, EVCCRef: "https://github.com/evcc-io/evcc/blob/master/templates/definition/meter/huawei-sun2000.yaml", ZapVerified: true, RegisterSetName: "huawei", Defaults: map[uint16]float64{ 32064: 0, 37001: 0, 37004: 65, 37113: 0, 32089: 700, 32085: 50, }, }, "fronius-gen24": { Name: "fronius-gen24", Description: "Fronius GEN24 Plus Hybrid", Protocol: "modbus", DeviceType: "fronius", Categories: []string{"pv", "battery", "meter", "grid"}, EVCCRef: "https://github.com/evcc-io/evcc/blob/master/templates/definition/meter/fronius.yaml", ZapVerified: true, RegisterSetName: "fronius", Defaults: map[uint16]float64{ 40107: 0, 40321: 45, 40323: 0, 40100: 0, 40109: 5000, }, }, "deye-hybrid": { Name: "deye-hybrid", Description: "Deye Hybrid Inverter", Protocol: "modbus", DeviceType: "deye", Categories: []string{"pv", "battery", "meter", "grid", "control"}, ZapVerified: true, RegisterSetName: "deye", Defaults: map[uint16]float64{ 672: 0, 590: 0, 588: 80, 619: 0, 653: 450, 79: 50, }, }, "pixii-powershaper": { Name: "pixii-powershaper", Description: "Pixii PowerShaper 2 (Battery Only)", Protocol: "modbus", DeviceType: "pixii", Categories: []string{"battery", "meter", "control"}, ZapVerified: true, RegisterSetName: "pixii", Defaults: map[uint16]float64{ 40168: 0, 40132: 50, 40188: 0, 40187: 5000, }, }, "ferroamp-energyhub": { Name: "ferroamp-energyhub", Description: "FerroAmp EnergyHub", Protocol: "modbus", DeviceType: "ferroamp", Categories: []string{"pv", "battery", "meter", "grid", "control"}, Defaults: map[uint16]float64{ 5016: 0, 13022: 55, 5600: 0, 13052: 1000, }, }, "sdm630": { Name: "sdm630", Description: "Eastron SDM630 Energy Meter (Meter Only)", Protocol: "modbus", DeviceType: "sdm630", Categories: []string{"meter"}, EVCCRef: "https://github.com/evcc-io/evcc/blob/master/templates/definition/meter/sdm.yaml", ZapVerified: true, RegisterSetName: "sdm630", Defaults: map[uint16]float64{ 0: 230.0, 2: 230.0, 4: 230.0, 6: 0.0, 8: 0.0, 10: 0.0, 12: 0.0, 14: 0.0, 16: 0.0, 52: 0.0, 70: 50.0, 72: 100.0, 74: 50.0, }, Generators: map[string]GeneratorConfig{ "load": { Type: "sine", Config: map[string]interface{}{ "amplitude": 1000.0, "offset": 1500.0, "period": 24.0, }, }, }, }, "fronius-smart-meter": { Name: "fronius-smart-meter", Description: "Fronius Smart Meter TS 65A-3 (SunSpec)", Protocol: "modbus", DeviceType: "fronius", Categories: []string{"meter"}, ZapVerified: true, RegisterSetName: "fronius-smart-meter", Defaults: map[uint16]float64{ 40074: 0.0, 40076: 0.0, 40078: 0.0, 40086: 230.0, 40088: 230.0, 40090: 230.0, 40092: 0.0, 40094: 50.0, }, }, "residential-5kw": { Name: "residential-5kw", Description: "Typical 5kW Residential System", Protocol: "modbus", DeviceType: "generic", Categories: []string{"pv", "battery", "meter", "grid", "control"}, Defaults: map[uint16]float64{ 5016: 0, 13021: 0, 13022: 50, 5600: 0, 13052: 500, 33046: 500, 33047: 500, }, Generators: map[string]GeneratorConfig{ "solar_radiance": { Type: "daynight", Config: map[string]interface{}{ "peak_power": 5000.0, "sunrise_hour": 6.0, "sunset_hour": 20.0, "noise": 5.0, }, }, "load": { Type: "schedule", Config: map[string]interface{}{ "base_load": 400.0, "schedule": []map[string]interface{}{ {"hour_start": 6, "hour_end": 8, "load": 1500}, {"hour_start": 17, "hour_end": 22, "load": 2500}, }, }, }, }, }, "commercial-50kw": { Name: "commercial-50kw", Description: "50kW Commercial System", Protocol: "modbus", DeviceType: "generic", Categories: []string{"pv", "battery", "meter", "grid", "control"}, Defaults: map[uint16]float64{ 5016: 0, 13021: 0, 13022: 60, 5600: 0, 13052: 5000, 33046: 5000, 33047: 5000, }, Generators: map[string]GeneratorConfig{ "solar_radiance": { Type: "daynight", Config: map[string]interface{}{ "peak_power": 50000.0, "sunrise_hour": 6.0, "sunset_hour": 20.0, }, }, "load": { Type: "schedule", Config: map[string]interface{}{ "base_load": 2000.0, "schedule": []map[string]interface{}{ {"hour_start": 8, "hour_end": 18, "load": 15000}, }, }, }, }, }, "default": { Name: "default", Description: "Default profile (all registers)", Protocol: "modbus", DeviceType: "generic", Categories: []string{"pv", "battery", "meter", "grid", "control"}, Defaults: map[uint16]float64{}, }, "ambibox": { Name: "ambibox", Description: "Ambibox V2X Bidirectional Charger", Protocol: "mqtt", DeviceType: "ambibox", Categories: []string{"ev", "v2x", "bidirectional"}, ZapVerified: true, MQTTConfig: &MQTTConfig{ BaseTopic: "device/evCharger/0", PublishIntervalMs: 1000, Defaults: map[string]interface{}{ "sessionState": "PAUSED", "controlMode": "CONTROLLABLE", "evConnected": false, "chargeProtocol": "CCS", "powerAc": float64(0), "powerDc": float64(0), "currentAc1": float64(0), "currentAc2": float64(0), "currentAc3": float64(0), "voltageAc1": float64(230), "voltageAc2": float64(230), "voltageAc3": float64(230), "frequency": float64(50), "soc": float64(50), "chargePowerMax": float64(11000), "dischargePowerMax": float64(11000), "chargePowerMin": float64(1400), "dischargePowerMin": float64(1400), "energyAcImport": float64(0), "energyAcExport": float64(0), }, }, MDNSConfig: &MDNSConfig{ Hostname: "sid-os", ServiceType: "_mqtt._tcp", }, }, "ocpp-charger": { Name: "ocpp-charger", Description: "Generic OCPP 1.6 EV Charger", Protocol: "ocpp", DeviceType: "ocpp-charger", Categories: []string{"ev", "charger"}, OCPPConfig: &OCPPConfig{ Version: "1.6", Vendor: "SimulatorCo", Model: "SimCharger-22", NumConnectors: 2, MaxPowerKW: 22, Configuration: map[string]string{ "HeartbeatInterval": "60", "MeterValueSampleInterval": "30", "NumberOfConnectors": "2", }, DefaultStatus: "Available", }, }, "chargeamps-dawn": { Name: "chargeamps-dawn", Description: "Charge Amps DAWN (7.7kW, 3-phase)", Protocol: "ocpp", DeviceType: "chargeamps", Categories: []string{"ev", "charger"}, OCPPConfig: &OCPPConfig{ Version: "1.6", Vendor: "Charge Amps", Model: "DAWN", NumConnectors: 1, MaxPowerKW: 7.7, Configuration: map[string]string{ "HeartbeatInterval": "60", "MeterValueSampleInterval": "30", "NumberOfConnectors": "1", "ConnectorSwitch3to1PhaseSupported": "false", "ChargingScheduleAllowedChargingRateUnit": "Current", "SupportedFeatureProfiles": "Core,SmartCharging,RemoteTrigger,LocalAuthListManagement", }, DefaultStatus: "Available", }, }, }
EmbeddedProfiles contains built-in profiles for common device types
Functions ¶
This section is empty.
Types ¶
type GeneratorConfig ¶
type GeneratorConfig struct {
Type string `json:"type"`
Config map[string]interface{} `json:"config,omitempty"`
}
GeneratorConfig defines a value generator
type MDNSConfig ¶
type MDNSConfig struct {
Hostname string `json:"hostname"` // e.g. "sid-os" (without .local)
ServiceType string `json:"service_type,omitempty"` // e.g. "_mqtt._tcp"
}
MDNSConfig holds mDNS advertisement configuration for a profile
type MQTTConfig ¶
type MQTTConfig struct {
BaseTopic string `json:"base_topic"`
PublishIntervalMs int `json:"publish_interval_ms,omitempty"`
Defaults map[string]interface{} `json:"defaults,omitempty"`
}
MQTTConfig holds MQTT-specific profile configuration
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles profile loading and storage
func NewManager ¶
NewManager creates a new profile manager
func (*Manager) GetActiveName ¶
GetActiveName returns the name of the active profile
func (*Manager) InitEmbedded ¶
func (m *Manager) InitEmbedded()
InitEmbedded adds embedded profiles to the manager
func (*Manager) List ¶
func (m *Manager) List() []ProfileInfo
List returns all profile names sorted alphabetically
func (*Manager) ListByProtocol ¶
func (m *Manager) ListByProtocol(protocol string) []ProfileInfo
ListByProtocol returns profiles filtered by protocol
func (*Manager) ListByProtocolAndCategory ¶
func (m *Manager) ListByProtocolAndCategory(protocol string, category string) []ProfileInfo
ListByProtocolAndCategory returns profiles filtered by protocol and category
type OCPPConfig ¶
type OCPPConfig struct {
Version string `json:"version"` // "1.6" or "2.0.1"
Vendor string `json:"vendor"`
Model string `json:"model"`
NumConnectors int `json:"num_connectors"`
MaxPowerKW float64 `json:"max_power_kw"`
Configuration map[string]string `json:"configuration,omitempty"`
DefaultStatus string `json:"default_status,omitempty"`
}
OCPPConfig holds OCPP-specific profile configuration
type Profile ¶
type Profile struct {
Name string `json:"name"`
Description string `json:"description"`
Protocol string `json:"protocol"` // modbus, mqtt, ocpp
DeviceType string `json:"device_type"`
Categories []string `json:"categories,omitempty"` // pv, battery, meter, grid, control, ev, v2x, charger
EVCCRef string `json:"evcc_ref,omitempty"` // Link to EVCC template
ZapVerified bool `json:"zap_verified,omitempty"` // True if register map is synced with zap-x firmware
RegisterSetName string `json:"register_set_name,omitempty"` // Maps to devices.GetRegisterSet() for native register addresses
// Modbus-specific
Defaults map[uint16]float64 `json:"defaults,omitempty"`
// MQTT-specific (V2X chargers)
MQTTConfig *MQTTConfig `json:"mqtt_config,omitempty"`
// OCPP-specific
OCPPConfig *OCPPConfig `json:"ocpp_config,omitempty"`
// mDNS advertisement (optional)
MDNSConfig *MDNSConfig `json:"mdns_config,omitempty"`
// Generators work across all protocols
Generators map[string]GeneratorConfig `json:"generators,omitempty"`
}
Profile defines a device simulation profile