When I set up nmap to see who is home and away the nmap found many things on my network, and I thought it was nice to have them all shown to see that the equipment is connected or not.
But Home and Away does not suite my computer since it is always home, so I want it to show online and offline or something similar, is it possible?
I use a multi line template here. home-assistant.io/components/sensor.template/.
I have all devices which do not have longitude, latitude or gps_accuracy in state attributes change state: home to state: online and state: not_home to state: offline
if and else go a long way here.
Easier solution would be to have device tracker component changed to have offline and online status added and only shown instead if longitude, latitude or gps_accuracy are not presented in state attributes.
This is exactly what I have been looking to do. I did not know that device_tracker had a template or where to put this
@dennisaion, would it be possible to show part of your code as an example? I am still not so good in understanding it from the provided link.
- platform: template
sensors:
kylo:
value_template: "{% if is_state('device_tracker.kyloren', 'home') %}online{% else %}offline{% endif %}"
snoke:
value_template: "{% if is_state('device_tracker.snoke', 'home') %}online{% else %}offline{% endif %}"
Sorry for being out for so long to respond. Had some other things to attend to.
I came here only to say thank you.
No problem.
Hey, dennisaion. Can you still use your solution today? I’ve been trying this all morning and nothing happens. Would you take a look?
sensor:
- platform: template
sensors:
device_tracker_kyocera_ecosys_m5526cdw:
value_template: "{% if is_state('device_tracker_kyocera_ecosys_m5526cdw', 'home') %}ON{% else %}Off{% endif %}"
try this
sensor:
- platform: template
sensors:
device_tracker_kyocera_ecosys_m5526cdw:
value_template: "{% if is_state('device_tracker.kyocera_ecosys_m5526cdw', 'home') %}ON{% else %}Off{% endif %}"
Unfortunately not. I’ve already tried this spelling.
Has anyone else renamed this and can help me?
Did HA create a sensor called sensor.device_tracker_kyocera_ecosys_m5526cdw
?
If not, there should be an error in Configuration -> Logs.
Please be informed that the template you use, will not override the state of device_tracker.kyocera_ecosys_m5526cdw
, it creates a new sensor, which shows your desired states.
Thank you so much!!!