tomaae / homeassistant-mikrotik_router

Mikrotik router integration for Home Assistant
Apache License 2.0
301 stars 50 forks source link

Kid control blocked status #247

Closed nerodoxus closed 1 year ago

nerodoxus commented 1 year ago

Is it possible to implement dedicated sensor or add an attribute to existing sensor that inform about the current status of blocking? It's indicated in the winnbox by B letter in the first column of the Kids tab.

tomaae commented 1 year ago

you will need to give me more info about it. I know very little about kid control, its all implemented based on requests and what made sense to me.

sshalyminov commented 1 year ago

Here how to know this:

[*@MikroTik] > /ip/kid-control/print
Flags: B, L - RATE-LIMITED
Columns: NAME, SUN, MON, TUE, WED, THU, FRI, SAT
#   NAME   SUN        MON        TUE         WED        THU        FRI        SAT      
0   artem  8h-21h45m  8h-21h45m  8h-21h45m   8h-21h45m  8h-21h45m  8h-21h45m  8h-21h45m
1 B danya  8h-21h45m  8h-21h45m  15h-21h45m  8h-21h45m  8h-21h45m  8h-21h45m  8h-21h45m

You can see B flag on user danya - he is blocked now Another user is not blocked

tomaae commented 1 year ago

hmm, I will need output from integration debug to know the variable. just kid-control info is fine

nerodoxus commented 1 year ago

This is the output in debug mode. There are three kids defined and only Dany is blocked - attribute blocked is set to Ture.

[
  {
    ".id": "*1",
    "name": "Alan",
    "sun": "16h-22h",
    "mon": "16h-22h",
    "tue": "16h-22h",
    "wed": "16h-22h",
    "thu": "16h-22h",
    "fri": "16h-23h",
    "sat": "16h-23h",
    "rate-limit": "",
    "tur-sun": "",
    "tur-mon": "",
    "tur-tue": "",
    "tur-wed": "",
    "tur-thu": "",
    "tur-fri": "",
    "tur-sat": "",
    "paused": false,
    "disabled": true
  },
  {
    ".id": "*2",
    "name": "Ellen",
    "sun": "16h-22h",
    "mon": "16h-22h",
    "tue": "16h-22h",
    "wed": "16h-22h",
    "thu": "16h-22h",
    "fri": "16h-23h",
    "sat": "16h-23h",
    "rate-limit": "",
    "tur-sun": "",
    "tur-mon": "",
    "tur-tue": "",
    "tur-wed": "",
    "tur-thu": "",
    "tur-fri": "",
    "tur-sat": "",
    "paused": false,
    "disabled": true
  },
  {
    ".id": "*3",
    "name": "Dany",
    "sun": "6h-21h",
    "mon": "7h-21h",
    "tue": "7h-21h",
    "wed": "7h-21h",
    "thu": "7h-21h",
    "fri": "7h-22h",
    "sat": "6h-22h",
    "rate-limit": "",
    "tur-sun": "",
    "tur-mon": "",
    "tur-tue": "",
    "tur-wed": "",
    "tur-thu": "",
    "tur-fri": "",
    "tur-sat": "",
    "paused": false,
    "blocked": true,
    "disabled": false
  }
]
tomaae commented 1 year ago

I see, a hidden attribute. Thats not a problem.

tomaae commented 1 year ago

It should be available in master, can you test it? It should work, but this is first time I have to handle hidden bool, so need to check that.

nerodoxus commented 1 year ago

Great! It works! Here is the list of attributes of switch when status is blocked

attribution: Data provided by Mikrotik
blocked: true
rate_limit: ''
mon: 7h-21h
tue: 7h-21h
wed: 7h-21h
thu: 7h-21h
fri: 7h-22h
sat: 6h-22h
sun: 6h-13h
device_class: switch
icon: mdi:account
friendly_name: Mikrotik_home Kidcontrol Dany

While the status is not blocked, this attribute is set to false.

Than you for this improvement.

tomaae commented 1 year ago

thanks