This works in the way I had in mind, thanks for the help!
Ah. That explains it. Yeah the dev tools is a much better option. When looking for the real state of something too, Lovelace can change it.
Something to remember for next time.
So if I wouldāve posted the following that I now found through dev tools, would that have been okay? Just so Iāll know next time.
subreddit: worldnews
posts:
- id: psx72n
url: >-
https://nypost.com/2021/09/21/brazils-unvaccinated-president-eats-pizza-on-nyc-sidewalk/
title: Brazilās unvaccinated president had to eat pizza on NYC sidewalk
score: 3622
comms_num: 326
created: 1632274960
body: ''
- id: pswp4q
url: >-
https://edmonton.citynews.ca/2021/09/20/alberta-bar-threats-vaccine-passport/
title: >-
Alberta bar closes after 'overwhelming' number of threats after opting
into vax pass
score: 2780
comms_num: 454
created: 1632273187
body: ''
- id: psw70z
url: >-
https://www.npr.org/2021/09/21/1039380004/gilgamesh-dream-tablet-hobby-lobby-iraq-return
title: >-
An Ancient Tablet, Stolen Then Acquired By Hobby Lobby, Will Be Returned
To Iraq
score: 2185
comms_num: 161
created: 1632271444
body: ''
- id: psrgbm
url: >-
https://www.france24.com/en/live-news/20210921-xi-tells-un-china-will-stop-funding-coal-projects-overseas
title: Xi tells UN China will stop funding coal projects overseas
score: 3857
comms_num: 471
created: 1632256612
body: ''
- id: psy92w
url: >-
https://www.reuters.com/world/americas/brazils-health-minister-tests-positive-covid-19-nyc-2021-09-22/
title: Brazil's health minister tests positive for COVID-19 in NYC
score: 801
comms_num: 49
created: 1632278718
body: ''
- id: pt1qhi
url: >-
https://www.news.com.au/world/europe/furious-dad-made-paedophile-friend-who-abused-his-daughter-dig-his-own-grave/news-story/8c6ddb194c0e7070f8cbb8d0c7d3350d
title: >-
Furious dad āmade paedophile friend who abused his daughter dig his own
graveā
score: 284
comms_num: 92
created: 1632292776
body: ''
- id: pshvi0
url: >-
https://www.reuters.com/world/europe/france-weighs-australia-options-urges-britain-restore-trust-2021-09-21/
title: Germany warns of lost U.S. trust as France wins EU support
score: 7601
comms_num: 2815
created: 1632227908
body: ''
- id: psfaii
url: >-
https://www.reuters.com/world/uk/prince-andrew-is-served-accusers-sexual-assault-lawsuit-united-states-lawyers-2021-09-21/
title: Prince Andrew is served sexual assault lawsuit in United States
score: 68053
comms_num: 2760
created: 1632216456
body: ''
- id: psytcu
url: https://gizmodo.com/amazon-is-lobbying-the-u-s-to-legalize-weed-1847719317
title: Amazon Is Lobbying the U.S. to Legalize Weed
score: 367
comms_num: 99
created: 1632280772
body: ''
- id: pst2xj
url: >-
https://theintercept.com/2021/09/21/afghanistan-taliban-ahmad-massoud-flee/?utm_campaign=theintercept&utm_source=twitter&utm_medium=social
title: With No U.S. Support, Leaders of Afghan Resistance Flee the Country
score: 870
comms_num: 151
created: 1632261143
body: ''
sort_by: hot
friendly_name: reddit_worldnews
icon: mdi:reddit
That would have been perfect.
Not only does it show the full structure, itās easy to copy and paste too.
If you want it so sound less like a robot then there are ways to do that too.
{% set parts = ["the next post is","the post after is", "and then there is"] %}
{% for value in state_attr('sensor.reddit_worldnews', 'posts') -%}
{%- if loop.first %}The first post is {% elif loop.last %} and the last post is {% else %}, {{ parts[range(0,3) | random]}} {% endif -%}
{{ value.title}}
{%- endfor %}
That way it will āmix it upā a bit.
You can add more āpartsā and just adjust the range accordingly
Very nice! I was actually playing around with this exact thing. What was kind of working for me so far was this:
service: tts.cloud_say
data:
entity_id: media_player.nest_living_room
message: >-
Today in the news, {% for value in state_attr('sensor.reddit_worldnews',
'posts') -%} {{ value.title}}. {{ ["In other news,", "Next is,", "And,", "In another story,"] | random }}
{%- endfor %}
It works for the bits in between the titles, but it will say the lead up to a next title even after itās already gone through all of them. If Iām reading it correctly, I think yours is taking this into account as well. I will try it out, thanks!