kennedyshead / aioasuswrt

MIT License
24 stars 24 forks source link

added methods async_get_loadavg/async_get_meminfo/async_add_dns_record/async_get_interfaces_counts/async_get_temperature #39

Closed bskaplou closed 3 years ago

bskaplou commented 4 years ago

Added loadavg and meminfo to drag this data into HA for monitoring Added ability to set pair ipaddress=>hostname in router's dnsmasq for further convertion into service in HA Added method extracting all counters for all interfaces from /proc/net/dev Added method extracting cpu and radios temperature

bskaplou commented 4 years ago

Anybody here???

Eager to implement support of all above into hass...

kennedyshead commented 4 years ago

You must add unit tests here

kennedyshead commented 4 years ago

Just add commands to RunCommandMock, and then do:

@pytest.mark.asyncio
async def test_async_get_loadavg(event_loop, mocker):
    """Test for loadavg."""
    mocker.patch(
        'aioasuswrt.connection.SshConnection.async_run_command',
        side_effect=RunCommandMock)

For every function and assert the data.

The file is called rest_regex.py (stupidly enough, should be split up or renamed I think)

kennedyshead commented 4 years ago

And why do you reference this PR in python-miio?

kennedyshead commented 3 years ago

Giving this some thoughts and ok, I will merge this without test. There will from now on be a requirement for tests when doing PR:s