Quote of the Day Lovelace Card

Is there any way to control the refresh time? it show sometimes some quote for 1 sec and other arround 10 secs…
It seems to be too random in my opinion and I think there should be some control for how often the quote is changed since its not smooth looking atm.

Any ideas ?

1 Like

I noticed the same thing on speed of quotes. It would be nice to slow it down some.

Thought I’d share the QOTD card that I’m using from the quotes.rest website. I do like the inspirational pictures, but the plain markup text is nice when displaying the dashboard on an eInk display.

################################################
### REST Sensor Quote of the Day OOTD ##########
################################################
sensor:
  - platform: rest
    resource: https://quotes.rest/qod?language=en
    name: Quote of the Day
    scan_interval: 43200
    json_attributes_path: '$.contents.quotes[0]'
    json_attributes:
      - quote
      - author
      - category
    value_template: 'OK'

Lovelace Card:

type: markdown
content: >-
  ## {{ state_attr("sensor.quote_of_the_day", "quote") }}

  -- {{ state_attr("sensor.quote_of_the_day", "author") }}

1 Like

Tried using these settings… couldn’t get them to work. It appears this works for me with the added ‘:’ before the [0]

    json_attributes_path: '$.contents.quotes.[0]'

I want this but Joke of the day instead.

THANK YOU…only took me 2 years to get this working… perfect example!!!

1 Like

There is one on HACS

Thanks so much for that very nice idea! Is it still running? Seems like https://quotes.rest/ now needs authentication via API. And I don’t get that additional aspect to work. Any idea would be greatly appreciated.

I haven’t tried this yet (it’s been broken for a while now since they require authentication) but I believe you could just add something like this into the ‘resource’ line above to authenticate. Not sure on if that changes the jsonpath but you could play around in Postman to verify! Let me know if you figure it out!

http://quotes.rest/quote/random.json?api_key=<your_api_key>

Was looking at this recently. Seems like the way to get this working is to include the following in configuration.yaml:

  - platform: rest
    name: "They said so"
    resource: "http://quotes.rest/qod.json"
    json_attributes_path: "$.contents.quotes.[0]"
    headers:
      authorization: 'Bearer <<API>>'
      content-type: 'application/json'
    value_template: "OK"
    json_attributes:
     - author
     - quote
    scan_interval: 43200

I’m now trying to limit the length of a quote which can be done via JSON just need to figure out how to include this in the API.

2 Likes

EDIT: I had to change the resource URL from http:// to https://. I also redid my auth key, that may have only been necessary as I exceeded the 5 per day limit when trying to debug.

This was working for a while but I am now getting the following error:
JSON result was not a dictionary or list with 0th element a dictionary