Update keyboard_remote.py (#5535)
Update keyboard_remote.py (#5535)

* Update keyboard_remote.py

I added a couple of events: keyboard_remote_connected and keyboard_remote_disconnected, useful to trigger some action (for example: play a sound)
I changed the way the component refers to the keyboard: not by "descriptor", but by name.
The fact is that the udev system doesn't always give a name link in /dev/input/by-id folder and the actual /dev/input/eventX file changes automatically. 
For example, if I had my keyboard on /dev/input/event13 and then it disconnected, if something else connects to the system it will get the first input file available, that is /dev/input/event13. If the keyboard then reconnects, it will get /dev/input/event14, thus breaking the configuration.
Now it searches every time for the right input file.
The problem might be that, in case of ha upgrade, the pre-existing configuration won't work. I thing there are some guidelines here, but I am not sure.
I think it's inevitable: the initial idea to use a /dev/input/by-id/ symbolic link was good, but unfortunately it doesn't seem to work with bluetooth devices.

I haven't updated the documentation yet: I'm waiting for some ok about the change in configuration key names.

* Update keyboard_remote.py

That should do the trick.
You are right: device names can be duplicated, thus they're not reliable in case of multiple devices. Unfortunately, the only other information available is the physical address, even more complicated.
But in case you have just one keyboard remote of same model, the name works just fine. I'll put it in the documentation which, once the code is approved, I will promptly update.

* Update keyboard_remote.py

* Update keyboard_remote.py

* Update keyboard_remote.py

* Unwrap logger error

nugget/home-assistant,fbradyirl/home-assistant,eagleamon/home-assistant,soldag/home-assistant,morphis/home-assistant,tboyce1/home-assistant,ewandor/home-assistant,HydrelioxGitHub/home-assistant,auduny/home-assistant,persandstrom/home-assistant,w1ll1am23/home-assistant,postlund/home-assistant,MungoRae/home-assistant,Zac-HD/home-assistant,eagleamon/home-assistant,tinloaf/home-assistant,FreekingDean/home-assistant,robbiet480/home-assistant,partofthething/home-assistant,pschmitt/home-assistant,Duoxilian/home-assistant,joopert/home-assistant,tchellomello/home-assistant,home-assistant/home-assistant,kyvinh/home-assistant,auduny/home-assistant,partofthething/home-assistant,stefan-jonasson/home-assistant,turbokongen/home-assistant,keerts/home-assistant,keerts/home-assistant,eagleamon/home-assistant,rohitranjan1991/home-assistant,tinloaf/home-assistant,jnewland/home-assistant,titilambert/home-assistant,shaftoe/home-assistant,PetePriority/home-assistant,GenericStudent/home-assistant,jawilson/home-assistant,JshWright/home-assistant,auduny/home-assistant,jamespcole/home-assistant,morphis/home-assistant,Cinntax/home-assistant,nkgilley/home-assistant,tboyce021/home-assistant,robbiet480/home-assistant,keerts/home-assistant,open-homeautomation/home-assistant,soldag/home-assistant,Zac-HD/home-assistant,tchellomello/home-assistant,open-homeautomation/home-assistant,miniconfig/home-assistant,jabesq/home-assistant,Danielhiversen/home-assistant,w1ll1am23/home-assistant,toddeye/home-assistant,stefan-jonasson/home-assistant,molobrakos/home-assistant,morphis/home-assistant,tboyce021/home-assistant,Zac-HD/home-assistant,stefan-jonasson/home-assistant,open-homeautomation/home-assistant,lukas-hetzenecker/home-assistant,ct-23/home-assistant,aronsky/home-assistant,jnewland/home-assistant,qedi-r/home-assistant,miniconfig/home-assistant,sdague/home-assistant,FreekingDean/home-assistant,kyvinh/home-assistant,HydrelioxGitHub/home-assistant,LinuxChristian/home-assistant,HydrelioxGitHub/home-assistant,turbokongen/home-assistant,kennedyshead/home-assistant,ct-23/home-assistant,balloob/home-assistant,tboyce1/home-assistant,molobrakos/home-assistant,kyvinh/home-assistant,MartinHjelmare/home-assistant,tboyce1/home-assistant,Zac-HD/home-assistant,titilambert/home-assistant,molobrakos/home-assistant,shaftoe/home-assistant,balloob/home-assistant,fbradyirl/home-assistant,GenericStudent/home-assistant,jawilson/home-assistant,jabesq/home-assistant,happyleavesaoc/home-assistant,mKeRix/home-assistant,rohitranjan1991/home-assistant,home-assistant/home-assistant,alexmogavero/home-assistant,morphis/home-assistant,mezz64/home-assistant,nugget/home-assistant,toddeye/home-assistant,aronsky/home-assistant,persandstrom/home-assistant,MungoRae/home-assistant,kyvinh/home-assistant,mKeRix/home-assistant,stefan-jonasson/home-assistant,Duoxilian/home-assistant,alexmogavero/home-assistant,LinuxChristian/home-assistant,Teagan42/home-assistant,happyleavesaoc/home-assistant,LinuxChristian/home-assistant,sander76/home-assistant,DavidLP/home-assistant,mKeRix/home-assistant,joopert/home-assistant,adrienbrault/home-assistant,ct-23/home-assistant,PetePriority/home-assistant,MungoRae/home-assistant,mezz64/home-assistant,pschmitt/home-assistant,keerts/home-assistant,LinuxChristian/home-assistant,alexmogavero/home-assistant,alexmogavero/home-assistant,jamespcole/home-assistant,mKeRix/home-assistant,DavidLP/home-assistant,JshWright/home-assistant,Teagan42/home-assistant,miniconfig/home-assistant,jamespcole/home-assistant,JshWright/home-assistant,tinloaf/home-assistant,Danielhiversen/home-assistant,JshWright/home-assistant,ewandor/home-assistant,aequitas/home-assistant,LinuxChristian/home-assistant,open-homeautomation/home-assistant,MungoRae/home-assistant,PetePriority/home-assistant,aequitas/home-assistant,MungoRae/home-assistant,MartinHjelmare/home-assistant,fbradyirl/home-assistant,ct-23/home-assistant,nugget/home-assistant,lukas-hetzenecker/home-assistant,shaftoe/home-assistant,MartinHjelmare/home-assistant,sander76/home-assistant,ct-23/home-assistant,DavidLP/home-assistant,leppa/home-assistant,happyleavesaoc/home-assistant,Cinntax/home-assistant,miniconfig/home-assistant,Duoxilian/home-assistant,postlund/home-assistant,ewandor/home-assistant,eagleamon/home-assistant,adrienbrault/home-assistant,leppa/home-assistant,aequitas/home-assistant,qedi-r/home-assistant,tboyce1/home-assistant,kennedyshead/home-assistant,Duoxilian/home-assistant,jabesq/home-assistant,persandstrom/home-assistant,balloob/home-assistant,shaftoe/home-assistant,rohitranjan1991/home-assistant,nkgilley/home-assistant,sdague/home-assistant,happyleavesaoc/home-assistant,jnewland/home-assistant