Repository navigation
simcount: use component type - #3313
Merged
Merged
Conversation
LKuemmel
force-pushed
the
simcount-use-enum
branch
from
May 29, 2026 11:20
843e682 to
ec6814f
Compare
LKuemmel
force-pushed
the
simcount-use-enum
branch
from
June 16, 2026 12:43
a2cf8f7 to
ee34606
Compare
LKuemmel
force-pushed
the
simcount-use-enum
branch
from
July 7, 2026 13:49
ee34606 to
47bd4fd
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes component value-store creation and simcount initialization by switching device components from type-specific store factories (get_*_value_store) and SimCounter(prefix=...) usage to a single get_component_value_store(component_type, id) factory and SimCounter(..., component_type).
Changes:
- Added
modules.common.store._factory.get_component_value_store()and re-exported it viamodules.common.store. - Updated many device components (battery/counter/inverter) to call
get_component_value_store(self.component_config.type, self.component_config.id)and to constructSimCounter(..., self.component_config.type)instead ofprefix=.... - Updated related tests and sample docs; added
create_post_functionhelper; extendedConfigurableDevice.add_componentwith an optional dependency-injection hook.
Reviewed changes
Copilot reviewed 245 out of 245 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/modules/common/store/_factory.py | New unified value-store factory for bat/counter/inverter components. |
| packages/modules/common/store/init.py | Re-export get_component_value_store and stop exporting type-specific factories. |
| packages/modules/common/configurable_device.py | Adds optional component dependency injection during add_component. |
| packages/modules/common/store/_counter_test.py | Updates SimCounter construction to the new (component_type) argument. |
| packages/control/counter_all.py | Updates SimCounter construction to use ComponentType.COUNTER. |
| packages/modules/devices/generic/http/api.py | Adds create_post_function helper. |
| packages/modules/devices/vzlogger/vzlogger/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/vzlogger/vzlogger/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/vzlogger/vzlogger/counter_test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/victron/victron/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/victron/victron/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/victron/victron/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/victron/victron_3p75ct/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/varta/varta/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/varta/varta/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/varta/varta/bat_modbus.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/varta/varta/bat_api.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/upower/upower/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/upower/upower/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/upower/upower/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/thermia/thermia/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/tesla/tesla/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/tesla/tesla/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/tesla/tesla/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/tesla/tesla/tesla_test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/tasmota/tasmota/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/tasmota/tasmota/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/tasmota/tasmota/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sungrow/sungrow_sh/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sungrow/sungrow_sh/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sungrow/sungrow_sg/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sungrow/sungrow_sg/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sungrow/sungrow_micro/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sungrow/sungrow_ihm/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sungrow/sungrow_ihm/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sungrow/sungrow_ihm/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sonnen/sonnenbatterie/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sonnen/sonnenbatterie/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sonnen/sonnenbatterie/counter_consumption.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sonnen/sonnenbatterie/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solis/solis/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solis/solis/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/solis/solis/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solax/solax/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/solax/solax/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/solax/solax/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solaredge/solaredge/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solaredge/solaredge/external_inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/solaredge/solaredge/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/solaredge/solaredge/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solar_world/solar_world/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solar_world/solar_world/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solar_watt/solar_watt/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solar_watt/solar_watt/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solar_watt/solar_watt/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solar_view/solar_view/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/solar_view/solar_view/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/solar_log/solar_log/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/solar_log/solar_log/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solarmax/solarmax/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solarmax/solarmax/inverter_maxstorage.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solarmax/solarmax/counter_maxstorage.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solarmax/solarmax/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/solakon/solakon_one/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/solakon/solakon_one/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/sofar/sofar/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/sofar/sofar/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/sofar/sofar/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/smartfox/smartfox/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/smart_me/smart_me/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/smart_me/smart_me/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/studer/studer/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/studer/studer/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/sunways/sunways/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/shelly/shelly/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/shelly/shelly/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/shelly/shelly/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/saxpower/saxpower/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/saxpower/saxpower/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/rct/rct/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/rct/rct/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/rct/rct/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/qcells/qcells/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/qcells/qcells/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/qcells/qcells/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/powerfox/powerfox/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/powerfox/powerfox/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/powerdog/powerdog/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/powerdog/powerdog/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/openwb/openwb_flex/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/openwb/openwb_flex/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/openwb/openwb_flex/consumption_counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/openwb/openwb_flex/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/orno/orno/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/nibe/nibe/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/mystrom/mystrom/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/mtec/mtec/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/mtec/mtec/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/mtec/mtec/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/marstek/venus_c_e/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/lg/lg/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/lg/lg/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/lg/lg/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/kostal/kostal_steca/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/kostal/kostal_sem/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/kostal/kostal_plenticore/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/kostal/kostal_plenticore/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/kostal/kostal_piko/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/kostal/kostal_piko/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/kostal/kostal_piko/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/kostal/kostal_piko_old/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/kostal/kostal_piko_old/inverter_test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/kostal/kostal_piko_ci/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/kostal/kostal_piko_ci/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/kaco/kaco_tx/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/kaco/kaco_nh/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/kaco/kaco_nh/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/kaco/kaco_nh/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/janitza/janitza/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/janitza/janitza/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/janitza/janitza/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/idm/idm/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/huawei/huawei/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/huawei/huawei/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/huawei/huawei/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/huawei/huawei_smartlogger/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/huawei/huawei_smartlogger/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/huawei/huawei_smartlogger/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/huawei/huawei_emma/inverter.py | Switch to get_component_value_store; add SimCounter(..., type). |
| packages/modules/devices/huawei/huawei_emma/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/huawei/huawei_emma/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/growatt/growatt/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/growatt/growatt/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/growatt/growatt/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/good_we/good_we/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/good_we/good_we/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/good_we/good_we/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/generic/virtual/counter.py | Switch to get_component_value_store and SimCounter(..., type) (virtual counter case). |
| packages/modules/devices/generic/mqtt/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/generic/mqtt/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/generic/mqtt/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/generic/json/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/generic/json/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/generic/json/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/generic/json/device_test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/generic/http/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/generic/http/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/generic/http/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/fronius/fronius/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/fronius/fronius/inverter_secondary.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/fronius/fronius/inverter_production_meter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/fronius/fronius/inverter_production_meter_test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/fronius/fronius/counter_sm.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/fronius/fronius/counter_s0.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/fronius/fronius/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/fox_ess/fox_ess/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/fox_ess/fox_ess/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/fox_ess/fox_ess/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/fems/fems/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/fems/fems/inverter_test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/fems/fems/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/fems/fems/counter_test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/fems/fems/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/fems/fems/bat_test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/fems/fems/device test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/enphase/enphase/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/enphase/enphase/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/enphase/enphase/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/elgris/elgris/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/elgris/elgris/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/elgris/elgris/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/e3dc/e3dc/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/e3dc/e3dc/external_inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/e3dc/e3dc/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/e3dc/e3dc/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/discovergy/discovergy/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/discovergy/discovergy/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/discovergy/discovergy/device test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/deye/deye/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/deye/deye/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/deye/deye_solarman/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/deye/deye_solarman/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/deye/deye_solarman/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/chint/chint/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/carlo_gavazzi/carlo_gavazzi/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/byd/byd/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/batterx/batterx/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/batterx/batterx/external_inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/batterx/batterx/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/batterx/batterx/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/batterx/batterx/batterx_test.py | Monkeypatch updated to get_component_value_store. |
| packages/modules/devices/azzurro_zcs/azzurro_zcs/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/azzurro_zcs/azzurro_zcs/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/azzurro_zcs/azzurro_zcs/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/azzurro_zcs/azzurro_zcs_3p/pv_inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/avm/avm/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/anker/anker_solix/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/anker/anker_solix/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/anker/anker_solix/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/ampere/ampere/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/ampere/ampere/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/ampere/ampere/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/alpha_ess/alpha_ess/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/alpha_ess/alpha_ess/counter.py | Switch to get_component_value_store. |
| packages/modules/devices/alpha_ess/alpha_ess/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/algodue/algodue/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/algodue/algodue/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/algodue/algodue/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/youless/youless/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/sma/sma_shm/utils.py | Updates value store factory call to accept (type, id). |
| packages/modules/devices/sma/sma_shm/inverter.py | Switch to get_component_value_store via SpeedwireComponent factory. |
| packages/modules/devices/sma/sma_shm/counter.py | Switch to get_component_value_store via SpeedwireComponent factory. |
| packages/modules/devices/sma/sma_webbox/inverter.py | Switch to get_component_value_store. |
| packages/modules/devices/sma/sma_sunny_island/bat.py | Switch to get_component_value_store. |
| packages/modules/devices/sma/sma_sunny_boy/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sma/sma_sunny_boy/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sigenergy/sigenergy/inverter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sigenergy/sigenergy/counter.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/sigenergy/sigenergy/bat.py | Switch to get_component_value_store and SimCounter(..., type). |
| packages/modules/devices/fems/fems/device test.py | Monkeypatch updated to get_component_value_store. |
| docs/samples/sample_request_by_device/sample_request_by_device/inverter.py | Sample updated to new store factory and simcount argument. |
| docs/samples/sample_request_by_device/sample_request_by_device/counter.py | Sample updated to new store factory and simcount argument. |
| docs/samples/sample_request_by_device/sample_request_by_device/bat.py | Sample updated to new store factory and simcount argument. |
| docs/samples/sample_request_by_component/sample_request_by_component/inverter.py | Sample updated to new store factory and simcount argument. |
| docs/samples/sample_request_by_component/sample_request_by_component/counter.py | Sample updated to new store factory and simcount argument. |
| docs/samples/sample_request_by_component/sample_request_by_component/bat.py | Sample updated to new store factory and simcount argument. |
| docs/samples/sample_modbus/sample_modbus/inverter.py | Sample updated to new store factory and simcount argument. |
| docs/samples/sample_modbus/sample_modbus/counter.py | Sample updated to new store factory and simcount argument. |
| docs/samples/sample_modbus/sample_modbus/bat.py | Sample updated to new store factory and simcount argument. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+23
to
+29
| def create_post_function(url: str, path: Optional[str]) -> Callable[[Session, dict], None]: | ||
| if path is None: | ||
| return lambda _: None | ||
| else: | ||
| def post_function(session: Session, params: dict): | ||
| session.post(url + path, params=params, timeout=5) | ||
| return post_function |
Comment on lines
+1
to
+18
| from typing import Optional | ||
| from modules.common.component_type import ComponentType | ||
| from modules.common.simcount._simcounter import SimCounter | ||
| from modules.common.store._battery import get_bat_value_store | ||
| from modules.common.store._counter import get_counter_value_store | ||
| from modules.common.store._inverter import get_inverter_value_store | ||
|
|
||
|
|
||
| def get_component_value_store(component_type: str, | ||
| component_num: int, | ||
| add_child_values: bool = False, | ||
| simcounter: Optional[SimCounter] = None): | ||
| if ComponentType.BAT.value in component_type: | ||
| return get_bat_value_store(component_num) | ||
| elif ComponentType.COUNTER.value in component_type: | ||
| return get_counter_value_store(component_num, add_child_values, simcounter) | ||
| elif ComponentType.INVERTER.value in component_type: | ||
| return get_inverter_value_store(component_num) |
Comment on lines
114
to
121
| component = self.__component_factory(component_config) | ||
| component.initialized = False | ||
| self.components["component" + str(component_config.id)] = component | ||
| component.initialize() | ||
| component.initialized = True | ||
| if component_dependency_injection is not None: | ||
| component = component_dependency_injection(component) | ||
|
|
| from modules.common.component_state import CounterState | ||
| from modules.common.store import get_counter_value_store | ||
| from modules.common.component_type import ComponentDescriptor | ||
| from modules.common.store._factory import get_component_value_store |
| from modules.common.component_type import ComponentDescriptor | ||
| from modules.common.simcount._simcounter import SimCounter | ||
| from modules.common.store._counter import get_counter_value_store | ||
| from modules.common.store._factory import get_component_value_store |
LKuemmel
force-pushed
the
simcount-use-enum
branch
from
July 8, 2026 07:15
47bd4fd to
09def5a
Compare
Comment on lines
+1
to
+20
| from typing import Optional | ||
| from modules.common.component_type import ComponentType | ||
| from modules.common.simcount._simcounter import SimCounter | ||
| from modules.common.store._battery import get_bat_value_store | ||
| from modules.common.store._counter import get_counter_value_store | ||
| from modules.common.store._inverter import get_inverter_value_store | ||
|
|
||
|
|
||
| def get_component_value_store(component_type: str, | ||
| component_num: int, | ||
| add_child_values: bool = False, | ||
| simcounter: Optional[SimCounter] = None): | ||
| if ComponentType.BAT.value in component_type: | ||
| return get_bat_value_store(component_num) | ||
| elif ComponentType.COUNTER.value in component_type: | ||
| return get_counter_value_store(component_num, add_child_values, simcounter) | ||
| elif ComponentType.INVERTER.value in component_type: | ||
| return get_inverter_value_store(component_num) | ||
| else: | ||
| raise ValueError(f"Unknown component type: {component_type}") |
LKuemmel
force-pushed
the
simcount-use-enum
branch
from
July 8, 2026 07:52
09def5a to
3c01cd3
Compare
|
|
||
| def initialize(self) -> None: | ||
| self.store = self.kwargs['value_store_factory'](self.component_config.id) | ||
| self.store = self.kwargs['value_store_factory'](self.component_config.type, self.component_config.id) |
Comment on lines
+1
to
+22
| from typing import Optional | ||
| from modules.common.component_type import ComponentType, special_to_general_type_mapping | ||
| from modules.common.simcount._simcounter import SimCounter | ||
| from modules.common.store._battery import get_bat_value_store | ||
| from modules.common.store._counter import get_counter_value_store | ||
| from modules.common.store._inverter import get_inverter_value_store | ||
|
|
||
|
|
||
| def get_component_value_store(component_type_str: str, | ||
| component_num: int, | ||
| add_child_values: bool = False, | ||
| simcounter: Optional[SimCounter] = None): | ||
| component_type = special_to_general_type_mapping( | ||
| component_type_str.value if isinstance(component_type_str, ComponentType) else component_type_str) | ||
| if ComponentType.BAT == component_type: | ||
| return get_bat_value_store(component_num) | ||
| elif ComponentType.COUNTER == component_type: | ||
| return get_counter_value_store(component_num, add_child_values, simcounter) | ||
| elif ComponentType.INVERTER == component_type: | ||
| return get_inverter_value_store(component_num) | ||
| else: | ||
| raise ValueError(f"Unknown component type: {component_type}") |
Comment on lines
+9
to
+22
| def get_component_value_store(component_type_str: str, | ||
| component_num: int, | ||
| add_child_values: bool = False, | ||
| simcounter: Optional[SimCounter] = None): | ||
| component_type = special_to_general_type_mapping( | ||
| component_type_str.value if isinstance(component_type_str, ComponentType) else component_type_str) | ||
| if ComponentType.BAT == component_type: | ||
| return get_bat_value_store(component_num) | ||
| elif ComponentType.COUNTER == component_type: | ||
| return get_counter_value_store(component_num, add_child_values, simcounter) | ||
| elif ComponentType.INVERTER == component_type: | ||
| return get_inverter_value_store(component_num) | ||
| else: | ||
| raise ValueError(f"Unknown component type: {component_type}") |
LKuemmel
marked this pull request as ready for review
July 8, 2026 09:14
ndrsnhs
pushed a commit
to ndrsnhs/core
that referenced
this pull request
Aug 24, 2026
* simcount: use component type * migrate new modules * flake8 * rebase * review * fix * improve * fix
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.