Grabbing A Sensor value in Markdown card

So most of the resources on this haven’t been updated in a while. All I’m trying to do is pull the state value from a sensor and put it into a markdown card to format the value.

I’m trying to display my blood pressure from Withings in a neater way that looks more representative of how people read blood pressure. Ec. 120/70mmhg.
In my case I have two sensors.
sensor.systolic_blood_pressure
sensor.diastolic_blood_pressure
I also have a sensor.date_formatted that I’d like to add incase there’s a difference when calling a numeric value rather than a string.

Thanks in advance!

1 Like

You just use this in your markdown card content:

{{ sensor.systolic_blood_pressure }}

I really feel like an idiot, but it still doesn’t work for me.

type: markdown
content: {{ sensor.withings_systolic_blood_pressure_mmhg }}

I then receive the following error:
" Visual editor is not supported for this configuration:

  • The provided value for “content” is not supported by the visual editor. We support (string) but received ({"[object Object]":null}).

You can still edit your config in YAML."
When I’m in developer tools, it pulls the latest number just fine. I’m not sure what I’m doing wrong.

I also tried leaving the >- at the beginning of content but that just results in:
Configuration errors detected:
can not read an implicit mapping pair; a colon is missed (3:79)

1 | …
2 | …
3 | … sensor.withings_systolic_blood_pressure_mmhg }}
-----------------------------------------^
This is not my actual sensor ID in case you’re wondering.

My mistake. I was just out of bed and not thinking right. Should be:

{{ states('sensor.systolic_blood_pressure') }}

6 Likes

@tom_l Thanks so much, that worked! I did have a look at the markdown card
Markdown Card - Home Assistant but it didn’t seem to give me quite what I was looking for so thanks.