I have set sensor badlogin at sensor.yalm file:
- platform: command_line
name: badlogin
command: "grep -c 'Login attempt' /root/config/home-assistant.log"
scan_interval: 10
I have set logger at configuration.yalm file:
logger:
default: critical
logs:
homeassistant.components.http: warning
I tried twice to log with an invalid credentials into Home assistant. The action filled a log file by two string lines:
2021-04-09 22:03:42 WARNING (MainThread) [homeassistant.components.http.ban] Login attemptâŚ
2021-04-09 22:03:58 WARNING (MainThread) [homeassistant.components.http.ban] Login attemptâŚ
Unfortunately, the is status âunknownâ of sensor entity âsensor.badloginâ at Overview. I would expect number 2 instead of âunknownâ.
I have tested command grep -c âLogin attemptâ /root/config/home-assistant.log at terminal and it returns number 2.
Could you please advise what is wrong and explain why I get âunknownâ instead of number â2â?
Thank you very much,
Michal