Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/netgear/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
_LOGGER = logging.getLogger(__name__)

SCAN_INTERVAL = timedelta(seconds=30)
SPEED_TEST_INTERVAL = timedelta(seconds=1800)
SCAN_INTERVAL_FIRMWARE = timedelta(seconds=18000)
SPEED_TEST_INTERVAL = timedelta(hours=2)
SCAN_INTERVAL_FIRMWARE = timedelta(hours=5)


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/netgear/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ async def async_added_to_hass(self) -> None:
sensor_data = await self.async_get_last_sensor_data()
if sensor_data is not None:
self._value = sensor_data.native_value
else:
self.schedule_update_ha_state()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entity state is always updated by default when the entity is added to Home Assistant. We don't need this line.

What was the goal with this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually in this case the update coordinator does not fetch new data from the API when the entity is added to prevent large bandwidth usage of speedtest during boot of homeassistant.

So the goal is to have the update coordinator fetch data from the API only if no previous values are available (so this is a new entity).

@MartinHjelmare did I use the wrong command?
I think so...
Schould I have used await self.coordinator.async_request_refresh()?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct. 👍


@callback
def async_update_device(self) -> None:
Expand Down