Netgear Enhanced (sensors and switches for router controls)

Ok, did you edit it first to fit you router with ip, port and username/password that you use?

Yes :slight_smile:
I did thank you for the help

Based on some feedback, i updated switches.py to allow selection of switches in config. If no resources are defined, all will be used, however you can pick and choose now without hacking the code. The new code is live on gitlab.

in your switches config

  - platform: netgear_enhanced
    host: !secret router_ip
    username: !secret netgear_user
    password: !secret netgear_pass
    resources:
      - 'access_control'
      - 'traffic_meter'
      - 'parental_control'
      - 'qos'
      - '2g_guest_wifi'
      - '5g_guest_wifi'
      - 'run_speed_test'
      - 'reboot'
2 Likes

I’m really interested in getting notifications based on the monthly traffic. I’m guessing I need to make a template sensor to pull the NewMonthDownload attribute out of the sensor.ng_enhanced_traffic_meter. Does anyone know how to do this or is there a better way?

hey! can you share what you do with google cal please?

@Bigrob8181
thanks so much for this, its awesome!!

any thoughts about adding this to Custom Component: HACS

2 Likes

With Google calendar and Netgear enhanced integrated into your HA, this automation makes the guest wifi follow the calendar state.

- id: auto_guest_wifi
  alias: Auto guest wifi
  trigger:
    platform: state
    entity_id: calendar.your_calendar
  action:
    - service_template: >
        {% if is_state('calendar.your_calendar','Toggle') %}
          switch.toggle
        {% else %}
          switch.turn_{{ states('calendar.your_calendar')|lower }}
        {% endif %}
      entity_id: switch.ng_enhanced_2g_guest_wifi
1 Like

Thanks! this is just what i need.
im slightly confused however, sorry!
if i have an event in my calendar called “guest”, how can i trigger this to turn on only on those days?

I have a calendar just for the guest wifi (this automation triggers on every event).
You only need to change the entity_id’s calendar.your_calendar (x3) and switch.ng_enhanced_2g_guest_wifi (x1) to match your ID’s.

If you just want trigger by special name then add a condition:

condition:
    condition: template
    value_template: "{{is_state_attr('calendar.your_calendar', 'message', 'vacation') }}"

See bottom on page:
Google Calendar Event

1 Like

Hey @Bigrob8181 - any thoughts on adding to HACS sorry?

3 Likes

hey - can you share you switch.py file please?
im getting so many errors too

Hey, I use the official version since the latest update. Now you can choose which switches to use and the modifying is not needed (for the faults I had). If you haven’t updated then have a look on the repo how to.

Yep! Got the latest and see that

I get so many errors in my logs from this still

Hey. Both the speed test sensor and switch aren’t working but everything else is. Any ideas?

Do a debug to see what is creating your errors.

Log Details (ERROR)
Fri Jan 10 2020 05:42:48 GMT+0000 (Greenwich Mean Time)
Update for sensor.r7000p_gateway_bytes_sent fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 552, in write_bytes
    await self.body.write(writer)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/payload.py", line 231, in write
    await writer.write(self._value)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/http_writer.py", line 101, in write
    self._write(chunk)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/http_writer.py", line 67, in _write
    raise ConnectionResetError('Cannot write to closing transport')
ConnectionResetError: Cannot write to closing transport

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/upnp/sensor.py", line 146, in async_update
    self._state = await self._device.async_get_total_bytes_sent()
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 149, in async_get_total_bytes_sent
    return await self._igd_device.async_get_total_bytes_sent()
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/profiles/igd.py", line 99, in async_get_total_bytes_sent
    result = await action.async_call()
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/client.py", line 509, in async_call
    await self.service.requester.async_http_request('POST', url, headers, body)
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/client.py", line 70, in async_http_request
    body_type=body_type)
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/aiohttp.py", line 103, in async_do_http_request
    async with self._session.request(method, url, headers=headers, data=body) as response:
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 504, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 847, in start
    message, payload = await self._protocol.read()  # type: ignore  # noqa
  File "/usr/local/lib/python3.7/site-packages/aiohttp/streams.py", line 591, in read
    await self._waiter
aiohttp.client_exceptions.ClientOSError: [Errno None] Can not write request body for http://192.168.0.1:5000/Public_UPNP_C2

Seems like the private GitLab server is down.

Can someone who has a local copy of the repo push it to GitHub?

Give me a few and i will get it back online. Having server issues lately.

Edit: Server back online.

Once you have what you need, let me know, because i think i may be doing a full rebuild this weekend.

Unfortunately, I still can’t reach it :frowning:

Yes the server is down :pensive: