ollo69 / ha_asuswrt_custom

AsusWrt Custom HA integration
Apache License 2.0
7 stars 0 forks source link

Tracker seems not to be working correct, through a http setup #1

Open boheme61 opened 2 years ago

boheme61 commented 2 years ago

Opening this again ! Several Devices keeps "acting" weird, Cams, Plugs, Coordinators, reports offline thou they are online, and online thou they are turned off ... Ive never had these issues prior to installing asuswrt-custom over HTTP. Can't be right that HTTP should be so "unstable" , as mention, for more than 6 month everything "updated" correct within seconds, when i used ASUSWRT (official core) over SSH , and this behavior started after i installed the asuswrt-custom. Im on Core 2022.6 and OS 8.1

boheme61 commented 2 years ago

image

example. switch turned off for 2-3days now ... seems like it's the same for all switches( on/off don't appears in Tracker), and even the Cams

ollo69 commented 2 years ago

Should be useful double check what is reported in AsusWRT phone app I would expect that report this device "online". Can you also generate integration diagnostic and attach it here?

boheme61 commented 2 years ago

Yes ASUSWRT phone app reports online, Tapo app reports "Off" ...

Diag:

  },
  "integration_manifest": {
    "domain": "asuswrt_custom",
    "name": "ASUSWRT Custom",
    "config_flow": true,
    "documentation": "https://github.com/ollo69/ha_asuswrt_custom",
    "issue_tracker": "https://github.com/ollo69/ha_asuswrt_custom/issues",
    "requirements": [
      "aioasuswrt==1.4.0",
      "pyasuswrt==0.1.3"
    ],
    "codeowners": [
      "@ollo69"
    ],
    "iot_class": "local_polling",
    "loggers": [
      "aioasuswrt",
      "asyncssh",
      "pyasuswrt"
    ],
    "version": "0.1.6",
    "is_built_in": false
  },
  "data": {
    "entry": {
      "entry_id": "i removed it",
      "version": 1,
      "domain": "asuswrt_custom",
      "title": "192.168.50.1",
      "data": {
        "host": "192.168.50.1",
        "username": "**REDACTED**",
        "protocol": "http",
        "password": "**REDACTED**"
      },
      "options": {
        "consider_home": 180,
        "track_unknown": true
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": "**REDACTED**",
      "disabled_by": null
    },
    "device": {
      "area_id": null,
      "config_entries": [
        "70414ccc18e8dac3626c937a4a903605"
      ],
      "configuration_url": "http://192.168.50.1",
      "connections": "**REDACTED**",
      "disabled_by": null,
      "entry_type": null,
      "id": "i removed it",
      "identifiers": "**REDACTED**",
      "manufacturer": "Asus",
      "model": "RT-AX68U",
      "name_by_user": null,
      "name": "192.168.50.1",
      "suggested_area": null,
      "sw_version": "3.0.0.4.386_42808-g28fefb1",
      "hw_version": null,
      "via_device_id": null,
      "is_new": false,
      "entities": {
        "sensor.192_168_50_1_upload": {
          "unique_id": "**REDACTED**",
          "platform": "asuswrt_custom",
          "area_id": null,
          "capabilities": {
            "state_class": "total_increasing"
          },
          "config_entry_id": "70414ccc18e8dac3626c937a4a903605",
          "device_class": null,
          "device_id": "i removed it",
          "domain": "sensor",
          "disabled_by": "user",
          "entity_category": null,
          "hidden_by": null,
          "icon": null,
          "id": "4436d55f75c0092540a068ee2a3f57c2",
          "name": null,
          "options": {},
          "original_device_class": null,
          "original_icon": "mdi:upload",
          "original_name": "192.168.50.1 Upload",
          "supported_features": 0,
          "unit_of_measurement": "GB",
          "state": null
        },
        "sensor.192_168_50_1_upload_speed": {
          "unique_id": "**REDACTED**",
          "platform": "asuswrt_custom",
          "area_id": null,
          "capabilities": {
            "state_class": "measurement"
          },
          "config_entry_id": "70414ccc18e8dac3626c937a4a903605",
          "device_class": null,
          "device_id": "i removed it",
          "domain": "sensor",
          "disabled_by": "integration",
          "entity_category": null,
          "hidden_by": null,
          "icon": null,
          "id": "7815c266a3947be129ba7104e65d17b9",
          "name": null,
          "options": {},
          "original_device_class": null,
          "original_icon": "mdi:upload-network",
          "original_name": "192.168.50.1 Upload Speed",
          "supported_features": 0,
          "unit_of_measurement": "Mbit/s",
          "state": null
        },
        "sensor.192_168_50_1_download": {
          "unique_id": "**REDACTED**",
          "platform": "asuswrt_custom",
          "area_id": null,
          "capabilities": {
            "state_class": "total_increasing"
          },
          "config_entry_id": "70414ccc18e8dac3626c937a4a903605",
          "device_class": null,
          "device_id": "i removed it",
          "domain": "sensor",
          "disabled_by": "user",
          "entity_category": null,
          "hidden_by": null,
          "icon": null,
          "id": "b02d1d3079df6abfbdc28898fdac1c42",
          "name": null,
          "options": {},
          "original_device_class": null,
          "original_icon": "mdi:download",
          "original_name": "192.168.50.1 Download",
          "supported_features": 0,
          "unit_of_measurement": "GB",
          "state": null
        },
        "sensor.192_168_50_1_download_speed": {
          "unique_id": "**REDACTED**",
          "platform": "asuswrt_custom",
          "area_id": null,
          "capabilities": {
            "state_class": "measurement"
          },
          "config_entry_id": "70414ccc18e8dac3626c937a4a903605",
          "device_class": null,
          "device_id": "i removed it",
          "domain": "sensor",
          "disabled_by": "integration",
          "entity_category": null,
          "hidden_by": null,
          "icon": null,
          "id": "bcf9913ee9f6e88f7b99c7aa77e701bb",
          "name": null,
          "options": {},
          "original_device_class": null,
          "original_icon": "mdi:download-network",
          "original_name": "192.168.50.1 Download Speed",
          "supported_features": 0,
          "unit_of_measurement": "Mbit/s",
          "state": null
        },
        "sensor.connected_devices": {
          "unique_id": "**REDACTED**",
          "platform": "asuswrt_custom",
          "area_id": null,
          "capabilities": {
            "state_class": "measurement"
          },
          "config_entry_id": "70414ccc18e8dac3626c937a4a903605",
          "device_class": null,
          "device_id": "i removed it",
          "domain": "sensor",
          "disabled_by": null,
          "entity_category": null,
          "hidden_by": null,
          "icon": null,
          "id": "6e0ea199d5693e407e6d791534423537",
          "name": "Connected",
          "options": {},
          "original_device_class": null,
          "original_icon": "mdi:router-network",
          "original_name": "192.168.50.1 Devices Connected",
          "supported_features": 0,
          "unit_of_measurement": "Devices",
          "state": {
            "state": "21",
            "attributes": {
              "state_class": "measurement",
              "hostname": "192.168.50.1",
              "mac": "**REDACTED**",
              "unit_of_measurement": "Devices",
              "icon": "mdi:router-network",
              "friendly_name": "Connected"
            },
            "last_changed": "2022-06-03T10:18:04.688686+00:00",
            "last_updated": "2022-06-03T10:18:04.688686+00:00"
          }
        }
      },
      "tracked_devices": [
        {
          "name": "HOMEASSSERV",
          "ip_address": "192.168.50.251",
          "last_activity": "2022-06-03T10:25:04.714948+00:00"
        },
        {
          "name": "DSP-W218",
          "ip_address": "192.168.50.79",
          "last_activity": "2022-06-03T10:25:04.714972+00:00"
        },
        {
          "name": "Homeassistant",
          "ip_address": "192.168.50.25",
          "last_activity": "2022-06-03T10:25:04.714979+00:00"
        },
        {
          "name": "IKEA Hub",
          "ip_address": "192.168.50.103",
          "last_activity": "2022-06-03T10:25:04.714986+00:00"
        },
        {
          "name": "HOMESURF Wired",
          "ip_address": "192.168.50.243",
          "last_activity": "2022-06-03T10:25:04.714991+00:00"
        },
        {
          "name": "TCL TV",
          "ip_address": null,
          "last_activity": null
        },
        {
          "name": "MainHome",
          "ip_address": null,
          "last_activity": null
        },
        {
          "name": "TPP4",
          "ip_address": "192.168.50.44",
          "last_activity": "2022-06-03T10:25:04.715006+00:00"
        },
        {
          "name": "Aqara Hub",
          "ip_address": "192.168.50.39",
          "last_activity": "2022-06-03T10:25:04.715013+00:00"
        },
        {
          "name": "TCL WiFi",
          "ip_address": null,
          "last_activity": null
        },
        {
          "name": "DPlug",
          "ip_address": "192.168.50.174",
          "last_activity": "2022-06-03T10:25:04.715133+00:00"
        },
        {
          "name": "EXT 1",
          "ip_address": "192.168.50.247",
          "last_activity": "2022-06-03T10:25:04.715139+00:00"
        },
        {
          "name": "EXT 2",
          "ip_address": "192.168.50.106",
          "last_activity": "2022-06-03T10:25:04.715146+00:00"
        },
        {
          "name": "EXT 3",
          "ip_address": "192.168.50.175",
          "last_activity": "2022-06-03T10:25:04.715152+00:00"
        },
        {
          "name": "N2Plug",
          "ip_address": "192.168.50.164",
          "last_activity": "2022-06-03T10:25:04.715159+00:00"
        },
        {
          "name": "N3Plug",
          "ip_address": "192.168.50.21",
          "last_activity": "2022-06-03T10:25:04.715165+00:00"
        },
        {
          "name": "Philips TV",
          "ip_address": null,
          "last_activity": null
        },
        {
          "name": "SAMSUNG-G390F",
          "ip_address": "192.168.50.139",
          "last_activity": "2022-06-03T10:25:04.715174+00:00"
        },
        {
          "name": "TechWall",
          "ip_address": "192.168.50.214",
          "last_activity": "2022-06-03T10:25:04.715181+00:00"
        },
        {
          "name": "TPC1",
          "ip_address": "192.168.50.165",
          "last_activity": "2022-06-03T10:25:04.715186+00:00"
        },
        {
          "name": "TPC2",
          "ip_address": "192.168.50.53",
          "last_activity": "2022-06-03T10:25:04.715192+00:00"
        },
        {
          "name": "TPC3",
          "ip_address": "192.168.50.227",
          "last_activity": "2022-06-03T10:25:04.715198+00:00"
        },
        {
          "name": "TPC4",
          "ip_address": "192.168.50.253",
          "last_activity": "2022-06-03T10:25:04.715204+00:00"
        },
        {
          "name": "TPP3",
          "ip_address": "192.168.50.152",
          "last_activity": "2022-06-03T10:25:04.715209+00:00"
        },
        {
          "name": "N1Plug",
          "ip_address": null,
          "last_activity": null
        },
        {
          "name": "C310_34B39B",
          "ip_address": "192.168.50.118",
          "last_activity": "2022-06-03T10:25:04.715218+00:00"
        }
      ]
    }
  }
}
boheme61 commented 2 years ago

I guess it's because the "Tracker" only goes for "IP" , and not Checks the Belonging Integration, which i had the impression that Official ASUSWRT "Tracker" did, i could use this "state" in automations, as it responded within seconds. So maybe there also is a "different" update interval over http vs SSH ...

ollo69 commented 2 years ago

Device Tracker obviously only check for IP status in the Router and do not have any relation with status inside dedicated device integration. This is equal in official ASUSWRT integration and in this custom. The problem in official ASUSWRT integration based on SSH/Telnet is that the library not always report correct status as detected by the router. In any case you cannot use device tracker to manage automation that should be based on the device status, device tracker is only related to network availability by design.

boheme61 commented 2 years ago

hmmm, thats a bummer :( the router is the first that "discover" my phone, when i get home" ) , in my mind this should be the one to "rely" upon, so a tracker should.

  1. check whether device is discovered/ and "allowed"
  2. check whether device is "on" or "off" in related Integration

If there's no Tracker, checking whether a device is on/of, i have "missed" something, again im pretty sure that's how it has been for quite awhile in core-asuswrt. Thou again i did made some changes in my Router, that might have change the "behavior" in HA ... i clicked "manual setting/reserved" IP on all devices within DHCP scope ... so maybe this has caused the "Router" to not report devices on/of in HA, thou without me thinking about "Status" in the Router Anyway, i have prior used "Tracker" to show whether a device was "on/off" (Home/Away) "online/offline" Regardless if it was phone/switch/cam

Or, could it be so that connection through SSH, actually "cut-off " the connection in HA, when turning a switch off, and a switch therefore was reported "Away" in the GUI

ollo69 commented 2 years ago

Let me say that as code owner of ASUSWRT native integration I'm 100% sure about what integration do, that is exactly the same that this custom integration do, just using a different library. When you come home and your phone connect to the wifi, it become in status HOME. If you, for instance, disable wifi on your phone or you switch it off, it will become NOT HOME. But if you have a switch that is network connected, until the switch is connected to your wifi, it will be HOME, it doesn't matter if the status of the switch is On or Off. This can be detected only by switch dedicated integration. If SSH library report a switch NOT HOME when it is connected to wifi, it is just because is not detecting properly the connection status with the router and is not making his job properly.

boheme61 commented 2 years ago

Yeah i figured that out now, both laptops, Tv's, + HA zigbee-coordinators and Cams turns "not home" when turned off, in my mind a switch would/should do the same, but apparently not, ... switches does seems to always be " home " regardless if they are turned off . Sorry for my "ignorance" , maybe i didn't really pay that much attention to the switches, before i "switched" Tracker to this test-component I just added the wifi switches because there were there :) , and assumed they "worked" like other wifi Devices ( might just have had some plugs unplugged, and then seen them as "not home")

In regards to the "lack" in updating i really can't say whether that's do to http vs SSH, haven't looked deeper into to this (either), thou now that it seems i can "rule-out" switches as "relevant" in tracker, i can set back "consider home/away" to 60