Hello guys, i have this configuration:
device_tracker,rodolfo
on HA when i stay home , show me: Rodolfo home and when i not home show me; Rodolfo not_home.
how i can create a friendly_name, anyone knows?
thanks
SOLUTION
Sensor:
platform: template
sensors:
rodolfo:
value_template: ‘{% if is_state(“device_tracker.rodolfo”, “home”) %}Em Casa{% else %}Não está em Casa{% endif %}’
friendly_name: ‘Estado do Rodolfo’
silvrr
January 17, 2017, 5:04pm
2
You can do this two ways. First edit your known_devices.yaml file. Find that entry and edit the name.
See this for more information:
The other is customize:
@silvrr on my know_devices.yaml i have
rodolfo:
hide_if_away: false
mac:
name: Rodolfo
picture:
track: true
vendor:
where i can add the lines to my friendly_names ?
i want change HOME for Casa and change NOT_HOME for Não está em Casa
touliloup
(Romain)
January 17, 2017, 5:16pm
4
That’s to change the tracked device name, but I guess the wish is to change the status name itself.
I’m not sure that possible without modifying the source code of HASS.
silvrr
January 17, 2017, 5:16pm
5
Ahh, sorry I misunderstood what you wanted. I thought you were wanting to change the entity name. You are wanting to change the state name.
You will need to create a new template sensor. Rather than show your device_tracker on the front end you will need to add this new sensor.
sensor:
platform: template
sensors:
Rodolfo:
value_template: '{% if is_state("device_tracker.rodolfo", "home") %}Casa{% else %}Não está em Casa{% endif %}'
3 Likes
Great , thank YOU very much.
sorry again @silvrr
i add theset lines:
sensor:
platform: template
sensors:
Rodolfo:
value_template: ‘{% if is_state(“device_tracker.rodolfo”, “home”) %}Casa{% else %}Não está em Casa{% endif %}’
but when i restart my HA shows me:
Invalid config
The following components and platforms could not be set up:
sensor.template
Please check your config
i try some modification like this:
value_template: “{%if states.device_tracker.rodolfo.state == ‘home’ %}Casa{% elif states.device_tracker.rodolfo.state == ‘not_home’ %}nao esta em casa{% endif %}”
but no luck again.
what is wrong?
silvrr
January 17, 2017, 6:04pm
8
Can you post your config and maintain the formatting? See this post for instructions
Tips for new HASS/forum users. Help me out - what did I miss?
Posting your configuration
When you post your configuration, we need to see that you’ve got the spacing/indentation right. Use the “preformatted text”
[image]
YAML tips
YAML can be a harsh mistress. Spaces matter, tabs can break things. Here’s a post with some tips for editing YAML with Notepad++
What Home Assistant install method should I use?
If you’re pretty technical, use whatever works for you. Docker, NAS, All-in-one, Has…
Also, is there anything in your log file? Often it will give a reason and sometimes a specific line that is causing the error.
i dont any error on my log:
sensor.yaml
- platform: template
sensors:
phone_battery:
friendly_name: 'Bateria Rodolfo'
value_template: '{{ states.device_tracker.rodolfo.attributes.battery|float }}'
unit_of_measurement: "%"
entity_id:
- device_tracker.rodolfo
Rodolfo:
friendly_name: 'Estado Rodolfo'
value_template: "{%if states.device_tracker.rodolfo.state == 'home' %}Casa{% elif states.device_tracker.rodolfo.state == 'not_home' %}teste{% endif %}"
configuration.yaml
- sensor.phone_battery
- sensor.Rodolfo
@silvrr sorry on log i have this:
17-01-17 17:47:10 homeassistant.loader: Loaded sensor.template from homeassistant.components.sensor.template
17-01-17 17:47:10 homeassistant.bootstrap: Invalid config for [sensor.template]: [Rodolfo] is an invalid option for [sensor.template]. Check: sensor.template->sensors->Rodolfo. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.template/
17-01-17 17:47:10 homeassistant.core: Bus:Handling <Event call_service[L]: service_call_id=3051808912-1, domain=persistent_notification, service=create, service_data=title=Invalid config, message=The following components and platforms could not be set up:
sensor.template
Please check your config, notification_id=invalid_config>
17-01-17 17:47:10 homeassistant.core: Bus:Handling <Event state_changed[L]: entity_id=persistent_notification.invalid_config, new_state=<state persistent_notification.invalid_config=The following components and platforms could not be set up:
sensor.template
Please check your config; title=Invalid config @ 2017-01-17T17:47:10.810342+00:00>, old_state=None>
17-01-17 17:47:10 homeassistant.core: Bus:Handling <Event service_executed[L]: service_call_id=3051808912-1>
silvrr
January 17, 2017, 6:18pm
11
Try…
Sensor:
- platform: template
sensors:
rodolfo:
value_template: '{% if is_state("device_tracker.rodolfo", "home") %}Casa{% else %}teste{% endif %}'
friendly_name: 'Estado Rodolfo'
Sorry, I couldn’t get to my google drive (was down this morning) and was using a example on the forum for the code which doesn’t seem to work.
1 Like
@silvrr now it works like a charm.
thanks again for your patience
silvrr
January 17, 2017, 6:41pm
13
No problem, sorry I provided the incorrect config the first time. Writing up an post now so I can just reference it in the future.
1 Like