I’m sure there is a simple answer,I just cannot find it.
I have an MQTT Device Tracker component;
device_tracker:
- platform: mqtt
devices:
brian : 'presence/brian'
which displays
BTW, what are these elements called? If I knew that it may have helped my searching.
I’d like it to say home if the topic is true and away if the topic is false. I have also seen somewhere some code to change the colour of these elements based on the status (but cannot find it again).
Regarding it’s state of ‘true’ instead of ‘home’, what payload are you sending the mqtt topic? It should be home, away, not_home, etc… Not true or false.
Hi @tom_l, I’m aware the component simply displays what is in the topic payload, so I could change the payload, but it may well be easier to simply change what is displayed when the payload is true (I don’t know, hence the question).
Perhaps ultimately, the component itself needs extending to it can accept a payload_on text.
The underlying state of a device tracker is either home or not_home (assuming it doesn’t support GPS coordinates). You should update the software publishing to that topic to use those as shown in the docs.
Whilst I agree that the documentation here suggests that the state of a device tracker component should be home or not_home (for non GPS trackers) this makes no difference as the MQTT component simply passes through the payload.
If I did change the payload as suggested, I’d rather have ‘away’ displayed when the state is ‘not_home’ on the badge. Is it possible to change the badge text based on the state of the component device?
Hi @Mariusthvdb, How do you change the icons within the badges? Is there a reference somewhere on how to reference all the different parts of the badges?
##########################################################################################
# Badge-themes in order of severity, either up or down
##########################################################################################
#source https://github.com/home-assistant/home-assistant-polymer/blob/master/src/resources/ha-style.js
# /* for label-badge */
# --label-badge-background-color: white;
# --label-badge-text-color: rgb(76, 76, 76);
# --label-badge-red: #DF4C1E;
# --label-badge-blue: #039be5;
# --label-badge-green: #0DA035;
# --label-badge-yellow: #f4b400;
# --label-badge-grey: var(--paper-grey-500);
# not used?
# label-badge-border-color: green
# label-badge-label-color: green
# label-badge-blue: blue
# label-badge-green: black
# label-badge-yellow: yellow
# label-badge-grey: grey
green_badge:
label-badge-red: green
label-badge-background-color: white
label-badge-color: grey
label-badge-text-color: green
grey_badge:
label-badge-red: grey
label-badge-background-color: white
label-badge-color: black
label-badge-text-color: grey
black_badge:
label-badge-red: black
label-badge-background-color: white
label-badge-text-color: black
brown_badge:
label-badge-red: brown
label-badge-background-color: white
label-badge-text-color: brown
orange_badge:
label-badge-red: orange
label-badge-background-color: white
label-badge-text-color: orange
blue_badge:
label-badge-red: blue
label-badge-background-color: white
label-badge-text-color: blue
yellow_badge:
label-badge-red: grey
label-badge-background-color: yellow
label-badge-text-color: black
red_badge:
label-badge-red: grey
label-badge-background-color: white
label-badge-text-color: red
purple_badge:
label-badge-red: purple
label-badge-background-color: white
label-badge-text-color: black
primary-text-color: purple
secondary-text-color: purple
The icons/entity_pictures I showed are set in my Python script as follows: