eelcohn / home-assistant-ddwrt

DDWRT component/entity for Home Assistant
18 stars 7 forks source link

Handle disabled WiFi-network correctly #10

Open Nicols07 opened 3 years ago

Nicols07 commented 3 years ago

I've a problem :

2021-01-20 15:39:07 WARNING (MainThread) [custom_components.ddwrt] Unable to update about data: ('Unable to update router model data: %s', ExceptionTimeout(ReadTimeout(ReadTimeoutError("HTTPSConnectionPool(host='192.168.1.100', port=443): Read timed out. (read timeout=4)")))) 2021-01-20 15:39:07 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.1.100 (configuration.yaml) for ddwrt

{wl_mac::00:1D:7E:BD:48:EA}{wl_ssid::dd-wrt}{wl_channel::1}{wl_radio::Sans fil désactivé}{wl_xmit::200 mW}{wl_rate::54 Mbit/s}{wl_busy::}{wl_active::}{wl_quality::}{wl_ack::}{active_wireless::}{active_wds::}{assoc_count::0}{packet_info::SWRXgoodPacket=0;SWRXerrorPacket=4;SWTXgoodPacket=0;SWTXerrorPacket=90;}{uptime:: 15:47:13 up 15 min, load average: 0.00, 0.03, 0.03}{ipinfo::: Désactivé}

regards.

Nicols07 commented 3 years ago
ddwrt:
  - host: 192.168.1.100
    name: My DD-WRT Router
    username: NICOLS
    password: 101080
    ssl: true
    verify_ssl: false
    resources:
      - arp_clients
      - dhcp_clients
      - pppoe_clients
      - pptp_clients
      - wds_clients
      - wireless_clients
      - wan_connected
      - wl_radio
      - clk_freq
      - cpu_temp
      - ddns_status
      - dhcp_clients
      - sw_build
      - sw_date
      - sw_version
      - ip_connections
      - lan_dhcp_start
      - lan_dhcp_end
      - lan_dhcp_lease_time
      - lan_dns
      - lan_gateway
      - lan_ipaddr
      - lan_mac
      - lan_netmask
      - lan_proto
      - load_average1
      - load_average5
      - load_average15
      - network_bridges
      - nvram_used
      - nvram_total
      - router_manufacturer
      - router_model
      - router_time
      - uptime
      - voltage
      - wan_3g_signal
      - wan_dhcp_remaining
      - wan_dns0
      - wan_dns1
      - wan_dns2
      - wan_dns3
      - wan_dns4
      - wan_dns5
      - wan_gateway
      - wan_ipaddr
      - wan_ip6addr
      - wan_netmask
      - wan_pppoe_ac_name
      - wan_proto
      - wan_status
      - wan_traffic_in
      - wan_traffic_out
      - wan_uptime
      - wl_ack_timing
      - wl_ack_distance
      - wl_active
      - wl_busy
      - wl_channel
      - wl_count
      - wl_mac
      - wl_quality
      - wl_rate
      - wl_rx_packet_error
      - wl_tx_packet_error
      - wl_rx_packet_ok
      - wl_tx_packet_ok
      - wl_ssid
      - wl_xmit
      - traffic
Nicols07 commented 3 years ago

With this addon, we can't switch on or off Wifi. I do this for that :

shell_command:
  wifi_on: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/ssh/id_rsa root@192.168.1.100 wl radio on
  wifi_off: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/ssh/id_rsa root@192.168.1.100 wl radio off
hacs64 commented 3 years ago

@Nicols07 just installed Hass Where do I need to put these lines to get wifi switches? And I need to put the public key here /config/ssh/id_rsa yes?

Nicols07 commented 3 years ago

In your configuration.yaml on Home-Assistant :

shell_command:
    wifi_on: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/ssh/id_rsa root@192.168.1.100 wl radio on
    wifi_off: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/ssh/id_rsa root@192.168.1.100 wl radio off

switch:
  - platform: template
    switches:
      blind:
        friendly_name: "Wifi"
        turn_on:
          service: shell_command.wifi_on
        turn_off:
          service: shell_command.wifi_off

In a folder on Home-Assistant : image

In dd-wrt : image image

eelcohn commented 3 years ago

To be added in future release: