Skip to content

Commit

Permalink
fix: don't set the inverter obj directly to domain obj
Browse files Browse the repository at this point in the history
  • Loading branch information
mukaschultze committed Jan 20, 2024
1 parent 4e81e0c commit ffd8cd0
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions custom_components/must_inverter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
if not successReading:
raise ConfigEntryNotReady(f"Unable to read from modbus device")

hass.data[DOMAIN] = inverter
hass.data[DOMAIN][entry.entry_id] = inverter

for component in PLATFORMS:
hass.async_create_task(
Expand All @@ -59,7 +59,7 @@ async def async_unload_entry(hass, entry):
if not unload_ok:
return False

hass.data[DOMAIN] = None
hass.data[DOMAIN][entry.entry_id] = None
return True

class MustInverter:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/must_inverter/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
_LOGGER = logging.getLogger(__name__)

async def async_setup_entry(hass, entry, async_add_entities):
inverter = hass.data[DOMAIN]
inverter = hass.data[DOMAIN][entry.entry_id]
entities = []

for sensor_info in SENSORS_ARRAY:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/must_inverter/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
_LOGGER = logging.getLogger(__name__)

async def async_setup_entry(hass, entry, async_add_entities):
inverter = hass.data[DOMAIN]
inverter = hass.data[DOMAIN][entry.entry_id]
entities = []

for sensor_info in SENSORS_ARRAY:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/must_inverter/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
_LOGGER = logging.getLogger(__name__)

async def async_setup_entry(hass, entry, async_add_entities):
inverter = hass.data[DOMAIN]
inverter = hass.data[DOMAIN][entry.entry_id]
entities = []

for sensor_info in SENSORS_ARRAY:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/must_inverter/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
_LOGGER = logging.getLogger(__name__)

async def async_setup_entry(hass, entry, async_add_entities):
inverter = hass.data[DOMAIN]
inverter = hass.data[DOMAIN][entry.entry_id]
entities = []

for sensor_info in SENSORS_ARRAY:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/must_inverter/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
_LOGGER = logging.getLogger(__name__)

async def async_setup_entry(hass, entry, async_add_entities):
inverter = hass.data[DOMAIN]
inverter = hass.data[DOMAIN][entry.entry_id]
entities = []

for sensor_info in SENSORS_ARRAY:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/must_inverter/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
Setting(7, "RecordFault", True, True, 'mdi:alert'),
]

inverter = hass.data[DOMAIN]
inverter = hass.data[DOMAIN][entry.entry_id]
entities = []

for setting in settings:
Expand Down

0 comments on commit ffd8cd0

Please sign in to comment.