Hello all,
I have created a card that is displaying a couple different sensors. The problem I’m running into is that one of the sensors sensor.google_moon_info
has a state that is more than 255 characters. Since that is not allowed, I’m getting an unknown
state.
I’m wondering if anyone knows of a way to modify the sensor template so that it only displays the first 255 characters.
Here is my sensor config:
- platform: template
sensors:
google_moon_info:
friendly_name: 'Google Moon Info'
value_template: >
{{ state_attr('calendar.moon_astro', 'description') }}
If that is not possible, does anyone know how I can instead pull an attribute straight from the original entity calendar.moon_astro
?
Here is my card config:
entity: sensor.google_moon
show_icon: false
show_entity_picture: true
show_label: true
show_name: false
show_state: true
label: |
[[[
return states['sensor.google_moon_info'].state;
]]]
tap_action:
action: call-service
service: browser_mod.popup
service_data:
large: true
title: Moon/Astro Info
card:
type: entities
entities:
- sensor.google_moon_info
styles:
label:
- position: absolute
grid:
- grid-template-areas: '"n i" "s i" "l i"'
- grid-template-columns: 1fr 40%
state:
- font-size: 2.5em
- font-weight: bold
- text-transform: uppercase
- position: absolute
card:
- border: 1px solid rgb(255, 255, 255)
- padding: 4%
type: custom:button-card
Here is what it looks like: