Number Entity error in devcontainer

I have a custom component that creates a number entity. I am supplying the native value, but in my devcontainer I get the error saying that is doesn’t have _attr_value. It only is a problem in my dev environment, seems to work just find on my main HA instance. Any idea why the native_value isn’t working properly? I have class initialized like this:

def __init__(self, coordinator, chlorinator, setpoint, command):
        """Initialize the sensor."""
        super().__init__(coordinator)
        self._chlorinator = chlorinator
        self._type = setpoint
        self._command = command
        self._value = chlorinator[setpoint]
        self._available = True

And my native value defined as so:

@property
def native_value(self):
   """value"""
   return self._value

The error is:

2022-08-11 15:35:06 ERROR (MainThread) [homeassistant.components.number] Error adding entities for domain number with platform njspc_ha
Traceback (most recent call last):
  File "/workspaces/core/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/workspaces/core/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/workspaces/core/homeassistant/helpers/entity.py", line 810, in add_to_platform_finish
    self.async_write_ha_state()
  File "/workspaces/core/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
    self._async_write_ha_state()
  File "/workspaces/core/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/workspaces/core/homeassistant/helpers/entity.py", line 539, in _stringify_state
    if (state := self.state) is None:
  File "/workspaces/core/homeassistant/components/number/__init__.py", line 170, in state
    return self.value
  File "/workspaces/core/homeassistant/components/number/__init__.py", line 175, in value
    return self._attr_value
AttributeError: 'SWGNumber' object has no attribute '_attr_value'
2022-08-11 15:35:06 ERROR (MainThread) [homeassistant.components.number] Error while setting up njspc_ha platform for number
Traceback (most recent call last):
  File "/workspaces/core/homeassistant/helpers/entity_platform.py", line 257, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/workspaces/core/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/workspaces/core/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/workspaces/core/homeassistant/helpers/entity.py", line 810, in add_to_platform_finish
    self.async_write_ha_state()
  File "/workspaces/core/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
    self._async_write_ha_state()
  File "/workspaces/core/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/workspaces/core/homeassistant/helpers/entity.py", line 539, in _stringify_state
    if (state := self.state) is None:
  File "/workspaces/core/homeassistant/components/number/__init__.py", line 170, in state
    return self.value
  File "/workspaces/core/homeassistant/components/number/__init__.py", line 175, in value
    return self._attr_value
AttributeError: 'SWGNumber' object has no attribute '_attr_value'

I suspect this is related to the versions of HA you are running between live and dev. There was a significant update in 2022.7 to the number entity that i had a big issue making work with 2022.6 and 2022.7. Had to amend it to setup differently based on version of HA.

See

Also see here how i fixed this.

Thanks for the insight, that is most likely the problem as I was running the 2022.6 build. I tried to update my devcontainer to the latest (2022.9) but now it won’t load. I blew everything away including my repo and started over…still won’t load. I’m new to devcontainer and pretty much fiddle my way through programming in general, so maybe I’m missing something. This is what I end up with when I try to run the Home Assistant task.

 *  Executing task: hass -c ./config 


 *  The terminal process "/usr/bin/zsh '-c', 'hass -c ./config'" terminated with exit code: 1. 
 *  Press any key to close the terminal.

Never mind, I’m up and running now. I had to run Install All Requirements task first.