Parsing a JSON array and presenting the value in a group

I’m working on fetching a list of groceries from Wunderlist and I’m using the REST Sensor for this, my configuration looks like this:

- platform: rest
  resource: https://a.wunderlist.com/api/v1/tasks?list_id=123
  name: wunderlist
  value_template: >
    {% for x in value_json %}
      '{{x.title}}'
    {% endfor %}
  headers:
    X-Access-Token: 123
    X-Client-ID: 123

I’ve then got a group setup that is configured like this:

wunderlist:
    name: Groceries
    view: no
    entities:
      - sensor.rest_sensor_3

I’ve got two issus with this:

  1. It doesn’t look very good, it says “REST Sensor” as the name of the entity and it displays an ugly icon
  2. No linebreaks

So, how do I remove the “REST Sensor” text part, as well as the icon and split up each entry 1 on each line?

48 AM

Any pointers would be greatly appreciated!

First off the thing with the line breaks / one entry per entry in your list is a bit tricky and would probably need a component. Because the thing is I imagine your list is rather dynamic so one sensor per entry wouldn’t work like that. On the other hand you CAN do things to make it more readable e.g. put a number in front of every entry like this:

  value_template: >
    {% for x in value_json %}
      '{{ loop.index }}. {{ x.title }}'
    {% endfor %}

For the name of the sensor and the icon take a look at the customizing of entities here

~Cheers

How much would would there be to make a component out of this? Rather new to this so any pointers to good documentation on how to get started with easy REST components would be greatly appreciated!

A component would need some python knowledge. I did not yet attempt to make one. But there is enough documentation for it over here.

~Cheers

Checkout https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/sensor/london_underground.py https://github.com/home-assistant/home-assistant/tree/dev/homeassistant/components/london_underground
You could also consider a table on the front end

Cheers, know a fair bit of python so won’t be a big issue.

Just found the docs a bit lacking in good examples :slight_smile:

1 Like

Really cool idea :slight_smile: Will probably try your example as well.
Component sounds like a very nice idea :slight_smile:

I’m thinking of automations with Zones (i.e.: going into the supermarket pops up notification of whats missing)

FYI: The name and the icon you can easily change in the customize.yaml or in the customization tab in hassio UI. I believe that UI feature was recently added.

A proper Wunderlist component would be awesome, I haven’t found a better TODO system online yet. We use it for our household, groceries, wishlists, personal tasks, etc.

My use case primarily would be Wunderlist --> overdue tasks --> HASS --> TTS / notifcations

I agree with @liquidox wunderlis is the best TODO system and it would be nice to have component for HA.