Using data from Rest Sensor in Dashboard

Hi, i have a rest sensor, that feeds this back

['Id: 85320; Start: 2023-02-08T05:57:00Z', 'Id: 84876; Start: 2023-02-14T10:40:00Z', 'Id: 85122; Start: 2023-02-07T08:28:00Z', 'Id: 85142; Start: 2023-02-08T11:42:00Z', 'Id: 85250; Start: 2023-02-15T18:50:00Z', 'Id: 85205; Start: 2023-02-15T22:46:00Z']

I would like to show this on a dashboard. Like this.
(NUMBER) and color RED if date is before today
(NUMBER) and color Green if date is today.

Anyone who can point me in the right direction ?

You have multiple entries in the response… What is your idea? Seen like in a table?
Is the I’d changing or are they fix? Are you able to correlate the id to something else?

What is the final goal here?

Take a look at the custom:list-card. It looks like a good solution for what you are looking for, if I correctly understood what you are looking for.

The final goal, is to show an entity, containing all ID’s in a List/table. Where the background of the ID, is Either Red, or Green. Green if it’s todays date, and red if not.

Like This
85000 (RED)
85001 (RED)
85002 (Green)

The ID’s and the Date is unfortunately changing all the time.

Take a look at this post and my post after that, both changing cell background color based on the data, and please let me know if this is in any way close to what you are looking for:

That is basically what I have. What I was hoping for was coloring the entire row. But the cell with the condition is good enough.

The format of your data makes quite hard to work with… You have a string, but it should be a dict. Doing this transformation will be quite an issue. Take a look at this discussion: Parsing json (I think...) - #31 by petro

Could you please share your rest sensor yaml? You can exclude all the settings, I’m looking for how you work with the results (value_template and attributes).

1 Like
{# substitute x with the rest sensor list #}
{% set ns = namespace(out=[]) %}
{% for n in x %}
{% set i,s = n|regex_findall('Id:\ (\d*); Start:\ (.*)$')|first %}
{% set ns.out = ns.out + [{'id':i,'start':s}] %}
{% endfor %}
{{ ns.out }}

Thanks for sharing this @Troon, but my point is that doing this transformation for using it into the flex-table-card will probably require another sensor to retain the converted results, so unless he is using this string somewhere else I think it make more sense to apply this directly to the json value on the rest sensor itself to the results would be in a more workable format from the beginning and will reduce one sensor.

I am able to change the output of the rest sensor, this is not locked. But the raw output is something like this:

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS, HEAD
Access-Control-Allow-Headers: Content-Type, Accept, X-Requested-With, Authorization, x-xsrf-token
Content-Type: application/json
Connection: close
Transfer-Encoding: chunked

[
  {
    "showBrokenConstraintFlag": false,
    "useCapacityFromResource": false,
    "subOperationRespectParentCalendar": false,
    "subOperationParentLinkStep": null,
    "newRouteOnChangeResource": false,
    "progressHoursWorkloadExtra": 0.0,
    "useValueProfileFromResource": true,
    "quantityFactorDisplayedReciproc": true,
    "respectResourceCalendar": true,
    "description": null,
    "customText2": "2",
    "customText4": "2;1;5;",
    "templateOperationId": "120",
    "customText1": "0",
    "groupIndex": -1,
    "unburdenResource": false,
    "previousQueueTime": 0.0,
    "quantityOnOutput": true,
    "disabled": false,
    "targetCapacity": 4.614674665436087,
    "postQueueTime": 24.0,
    "instanceType": 0,
    "useOverlap": false,
    "displayType": 0,
    "operationSequenceId": "_853202",
    "capacityOnOutput": false,
    "workload": 3.25,
    "allowEndBeforeThisEnd": false,
    "setupTime": 2.0,
    "startCalendar": "2023-02-08T05:57:00Z",
    "quantity": 0.0,
    "endCalendar": "2023-02-08T11:42:00Z",
    "materialCalendar": null,
    "progressInHours": 0.0,
    "mainType": 0,
    "options": 0,
    "targetWorkload": 2.6,
    "baseline1End": "2023-02-20T10:24:00Z",
    "switchOverTime": 0.0,
    "quantityFactor": 1.0,
    "overlapCount": 0.0,
    "duration": 195.0,
    "overlapPercent": 0.0,
    "actualStartCalendar": null,
    "subOperationParentId": null,
    "actualEndCalendar": null,
    "wasteFactor": 0.0,
    "overlapValue": 0.0,
    "deliveryCalendar": null,
    "subOperationUpdateType": "WORKLOAD",
    "workloadType": 1,
    "overlapFixed": false,
    "quantityFinished": 0.0,
    "progressCalendar": null,
    "referenceEndCalendar": null,
    "workloadFactor": 1.0,
    "efficiency": 1.0,
    "capacity": 4.614674665436087,
    "transportTime": 0.0,
    "baseline1Start": "2023-02-17T15:08:00Z",
    "opLevel": 3,
    "progressQuantity": 0.0,
    "accountNumber": null,
    "customBoolean2": false,
    "endAnchor": 30,
    "remainingTimeRule": -1,
    "properties": "JobStatus\u003d0,0",
    "endAnchorType": 0,
    "emptyingTime": 0.0,
    "progressSetup": 0.0,
    "progressWorkload": 0.0,
    "progressScrapQuantity": 0.0,
    "linkType": 0,
    "customDouble1": 2.0,
    "customInt2": 0,
    "worktimeChainId": null,
    "invoiceStatus": 0,
    "customInt1": 0,
    "valueProfileId": null,
    "linkedObjectType": -1,
    "invoice": false,
    "planningFactor": 1.0,
    "customBoolean1": false,
    "linkedObjectId": null,
    "progressEmptying": 0.0,
    "calculatePriceRealised": false,
    "selectedResourceId": "120",
    "progressFillup": 0.0,
    "fillUpTime": 0.0,
    "invoicedDate": null,
    "nextOpNum": 0,
    "preferredResourceId": null,
    "baseManpower": 1.0,
    "progressSwitchOver": 0.0,
    "invoiceSum": 0.0,
    "siteId": null,
    "label": "30",
    "state": 30,
    "name": "120",
    "type": -2,
    "id": "853202_30_0_2_120",
    "tags": null,
    "anchor": 0,
    "opNum": 30,
    "locked": false
  },
  {
    "showBrokenConstraintFlag": false,
    "useCapacityFromResource": false,
    "subOperationRespectParentCalendar": false,
    "subOperationParentLinkStep": null,
    "newRouteOnChangeResource": false,
    "progressHoursWorkloadExtra": 0.0,
    "useValueProfileFromResource": true,
    "quantityFactorDisplayedReciproc": true,
    "respectResourceCalendar": true,
    "description": null,
    "customText2": "2",
    "customText4": "2;1;5;",
    "templateOperationId": "120",
    "customText1": "0",
    "groupIndex": -1,
    "unburdenResource": false,
    "previousQueueTime": 0.0,
    "quantityOnOutput": true,
    "disabled": false,
    "targetCapacity": 2.0,
    "postQueueTime": 24.0,
    "instanceType": 0,
    "useOverlap": false,
    "displayType": 0,
    "operationSequenceId": "_848760",
    "capacityOnOutput": false,
    "workload": 12.483333333333333,
    "allowEndBeforeThisEnd": false,
    "setupTime": 3.0,
    "startCalendar": "2023-02-14T10:40:00Z",
    "quantity": 0.0,
    "endCalendar": "2023-02-15T11:06:00Z",
    "materialCalendar": null,
    "progressInHours": 0.0,
    "mainType": 0,
    "options": 0,
    "targetWorkload": 10.0,
    "baseline1End": "2023-01-25T12:55:00Z",
    "switchOverTime": 0.0,
    "quantityFactor": 1.0,
    "overlapCount": 0.0,
    "duration": 749.0,
    "overlapPercent": 0.0,
    "actualStartCalendar": null,
    "subOperationParentId": null,
    "actualEndCalendar": null,
    "wasteFactor": 0.0,
    "overlapValue": 0.0,
    "deliveryCalendar": null,
    "subOperationUpdateType": "WORKLOAD",
    "workloadType": 1,
    "overlapFixed": false,
    "quantityFinished": 0.0,
    "progressCalendar": null,
    "referenceEndCalendar": null,
    "workloadFactor": 1.0,
    "efficiency": 1.0,
    "capacity": 2.0,
    "transportTime": 0.0,
    "baseline1Start": "2023-01-24T12:49:00Z",
    "opLevel": 4,
    "progressQuantity": 0.0,
    "accountNumber": null,
    "customBoolean2": false,
    "endAnchor": 30,
    "remainingTimeRule": -1,
    "properties": "JobStatus\u003d0,0",
    "endAnchorType": 0,
    "emptyingTime": 0.0,
    "progressSetup": 0.0,
    "progressWorkload": 0.0,
    "progressScrapQuantity": 0.0,
    "linkType": 0,
    "customDouble1": 3.0,
    "customInt2": 0,
    "worktimeChainId": null,
    "invoiceStatus": 0,
    "customInt1": 0,
    "valueProfileId": null,
    "linkedObjectType": -1,
    "invoice": false,
    "planningFactor": 1.0,
    "customBoolean1": false,
    "linkedObjectId": null,
    "progressEmptying": 0.0,
    "calculatePriceRealised": false,
    "selectedResourceId": "120",
    "progressFillup": 0.0,
    "fillUpTime": 0.0,
    "invoicedDate": null,
    "nextOpNum": 0,
    "preferredResourceId": null,
    "baseManpower": 1.0,
    "progressSwitchOver": 0.0,
    "invoiceSum": 0.0,
    "siteId": null,
    "label": "40",
    "state": 30,
    "name": "120",
    "type": -2,
    "id": "848760_40_0_2_120",
    "tags": null,
    "anchor": 0,
    "opNum": 40,
    "locked": false
  },
  {
    "showBrokenConstraintFlag": false,
    "useCapacityFromResource": false,
    "subOperationRespectParentCalendar": false,
    "subOperationParentLinkStep": null,
    "newRouteOnChangeResource": false,
    "progressHoursWorkloadExtra": 0.0,
    "useValueProfileFromResource": true,
    "quantityFactorDisplayedReciproc": true,
    "respectResourceCalendar": true,
    "description": null,
    "customText2": "2",
    "customText4": "2;1;5;",
    "templateOperationId": "120",
    "customText1": "0",
    "groupIndex": -1,
    "unburdenResource": false,
    "previousQueueTime": 0.0,
    "quantityOnOutput": true,
    "disabled": false,
    "targetCapacity": 7.501875468867217,
    "postQueueTime": 24.0,
    "instanceType": 0,
    "useOverlap": false,
    "displayType": 0,
    "operationSequenceId": "_851227",
    "capacityOnOutput": false,
    "workload": 6.65,
    "allowEndBeforeThisEnd": false,
    "setupTime": 3.5,
    "startCalendar": "2023-02-07T08:28:00Z",
    "quantity": 0.0,
    "endCalendar": "2023-02-07T19:19:00Z",
    "materialCalendar": null,
    "progressInHours": 0.0,
    "mainType": 0,
    "options": 0,
    "targetWorkload": 5.316666666666666,
    "baseline1End": "2023-02-08T14:44:00Z",
    "switchOverTime": 0.0,
    "quantityFactor": 1.0,
    "overlapCount": 0.0,
    "duration": 399.0,
    "overlapPercent": 0.0,
    "actualStartCalendar": null,
    "subOperationParentId": null,
    "actualEndCalendar": null,
    "wasteFactor": 0.0,
    "overlapValue": 0.0,
    "deliveryCalendar": null,
    "subOperationUpdateType": "WORKLOAD",
    "workloadType": 1,
    "overlapFixed": false,
    "quantityFinished": 0.0,
    "progressCalendar": null,
    "referenceEndCalendar": null,
    "workloadFactor": 1.0,
    "efficiency": 1.0,
    "capacity": 7.501875468867217,
    "transportTime": 0.0,
    "baseline1Start": "2023-02-07T20:29:00Z",
    "opLevel": 3,
    "progressQuantity": 0.0,
    "accountNumber": null,
    "customBoolean2": false,
    "endAnchor": 30,
    "remainingTimeRule": -1,
    "properties": "JobStatus\u003d0,0",
    "endAnchorType": 0,
    "emptyingTime": 0.0,
    "progressSetup": 0.0,
    "progressWorkload": 0.0,
    "progressScrapQuantity": 0.0,
    "linkType": 0,
    "customDouble1": 3.5,
    "customInt2": 0,
    "worktimeChainId": null,
    "invoiceStatus": 0,
    "customInt1": 0,
    "valueProfileId": null,
    "linkedObjectType": -1,
    "invoice": false,
    "planningFactor": 1.0,
    "customBoolean1": false,
    "linkedObjectId": null,
    "progressEmptying": 0.0,
    "calculatePriceRealised": false,
    "selectedResourceId": "120",
    "progressFillup": 0.0,
    "fillUpTime": 0.0,
    "invoicedDate": null,
    "nextOpNum": 0,
    "preferredResourceId": null,
    "baseManpower": 1.0,
    "progressSwitchOver": 0.0,
    "invoiceSum": 0.0,
    "siteId": null,
    "label": "30",
    "state": 30,
    "name": "120",
    "type": -2,
    "id": "851227_30_0_2_120",
    "tags": null,
    "anchor": 0,
    "opNum": 30,
    "locked": false
  },
  {
    "showBrokenConstraintFlag": false,
    "useCapacityFromResource": false,
    "subOperationRespectParentCalendar": false,
    "subOperationParentLinkStep": null,
    "newRouteOnChangeResource": false,
    "progressHoursWorkloadExtra": 0.0,
    "useValueProfileFromResource": true,
    "quantityFactorDisplayedReciproc": true,
    "respectResourceCalendar": true,
    "description": null,
    "customText2": "2",
    "customText4": "2;1;5;",
    "templateOperationId": "120",
    "customText1": "0",
    "groupIndex": -1,
    "unburdenResource": false,
    "previousQueueTime": 0.0,
    "quantityOnOutput": true,
    "disabled": false,
    "targetCapacity": 2.6089225150013045,
    "postQueueTime": 24.0,
    "instanceType": 0,
    "useOverlap": false,
    "displayType": 0,
    "operationSequenceId": "_851422",
    "capacityOnOutput": false,
    "workload": 45.983333333333334,
    "allowEndBeforeThisEnd": false,
    "setupTime": 6.0,
    "startCalendar": "2023-02-08T11:42:00Z",
    "quantity": 0.0,
    "endCalendar": "2023-02-14T10:08:00Z",
    "materialCalendar": null,
    "progressInHours": 0.0,
    "mainType": 0,
    "options": 0,
    "targetWorkload": 36.78333333333333,
    "baseline1End": "2023-02-15T20:34:00Z",
    "switchOverTime": 0.0,
    "quantityFactor": 1.0,
    "overlapCount": 0.0,
    "duration": 2759.0,
    "overlapPercent": 0.0,
    "actualStartCalendar": null,
    "subOperationParentId": null,
    "actualEndCalendar": null,
    "wasteFactor": 0.0,
    "overlapValue": 0.0,
    "deliveryCalendar": null,
    "subOperationUpdateType": "WORKLOAD",
    "workloadType": 1,
    "overlapFixed": false,
    "quantityFinished": 0.0,
    "progressCalendar": null,
    "referenceEndCalendar": null,
    "workloadFactor": 1.0,
    "efficiency": 1.0,
    "capacity": 2.6089225150013045,
    "transportTime": 0.0,
    "baseline1Start": "2023-02-10T05:23:00Z",
    "opLevel": 3,
    "progressQuantity": 0.0,
    "accountNumber": null,
    "customBoolean2": false,
    "endAnchor": 30,
    "remainingTimeRule": -1,
    "properties": "JobStatus\u003d0,0",
    "endAnchorType": 0,
    "emptyingTime": 0.0,
    "progressSetup": 0.0,
    "progressWorkload": 0.0,
    "progressScrapQuantity": 0.0,
    "linkType": 0,
    "customDouble1": 6.0,
    "customInt2": 0,
    "worktimeChainId": null,
    "invoiceStatus": 0,
    "customInt1": 0,
    "valueProfileId": null,
    "linkedObjectType": -1,
    "invoice": false,
    "planningFactor": 1.0,
    "customBoolean1": false,
    "linkedObjectId": null,
    "progressEmptying": 0.0,
    "calculatePriceRealised": false,
    "selectedResourceId": "120",
    "progressFillup": 0.0,
    "fillUpTime": 0.0,
    "invoicedDate": null,
    "nextOpNum": 0,
    "preferredResourceId": null,
    "baseManpower": 1.0,
    "progressSwitchOver": 0.0,
    "invoiceSum": 0.0,
    "siteId": null,
    "label": "30",
    "state": 30,
    "name": "120",
    "type": -2,
    "id": "851422_30_0_2_120",
    "tags": null,
    "anchor": 0,
    "opNum": 30,
    "locked": false
  },
  {
    "showBrokenConstraintFlag": false,
    "useCapacityFromResource": false,
    "subOperationRespectParentCalendar": false,
    "subOperationParentLinkStep": null,
    "newRouteOnChangeResource": false,
    "progressHoursWorkloadExtra": 0.0,
    "useValueProfileFromResource": true,
    "quantityFactorDisplayedReciproc": true,
    "respectResourceCalendar": true,
    "description": null,
    "customText2": "2",
    "customText4": "2;1;5;",
    "templateOperationId": "120",
    "customText1": "0",
    "groupIndex": -1,
    "unburdenResource": false,
    "previousQueueTime": 0.0,
    "quantityOnOutput": true,
    "disabled": false,
    "targetCapacity": 5.9988002399520095,
    "postQueueTime": 24.0,
    "instanceType": 0,
    "useOverlap": false,
    "displayType": 0,
    "operationSequenceId": "_852509",
    "capacityOnOutput": false,
    "workload": 0.2,
    "allowEndBeforeThisEnd": false,
    "setupTime": 3.5,
    "startCalendar": "2023-02-15T18:50:00Z",
    "quantity": 0.0,
    "endCalendar": "2023-02-16T06:17:00Z",
    "materialCalendar": null,
    "progressInHours": 0.0,
    "mainType": 0,
    "options": 0,
    "targetWorkload": 0.16666666666666666,
    "baseline1End": "2023-02-16T06:17:00Z",
    "switchOverTime": 0.0,
    "quantityFactor": 1.0,
    "overlapCount": 0.0,
    "duration": 12.0,
    "overlapPercent": 0.0,
    "actualStartCalendar": null,
    "subOperationParentId": null,
    "actualEndCalendar": null,
    "wasteFactor": 0.0,
    "overlapValue": 0.0,
    "deliveryCalendar": null,
    "subOperationUpdateType": "WORKLOAD",
    "workloadType": 1,
    "overlapFixed": false,
    "quantityFinished": 0.0,
    "progressCalendar": null,
    "referenceEndCalendar": null,
    "workloadFactor": 1.0,
    "efficiency": 1.0,
    "capacity": 5.9988002399520095,
    "transportTime": 0.0,
    "baseline1Start": "2023-02-15T18:50:00Z",
    "opLevel": 3,
    "progressQuantity": 0.0,
    "accountNumber": null,
    "customBoolean2": false,
    "endAnchor": 30,
    "remainingTimeRule": -1,
    "properties": "JobStatus\u003d0,0",
    "endAnchorType": 0,
    "emptyingTime": 0.0,
    "progressSetup": 0.0,
    "progressWorkload": 0.0,
    "progressScrapQuantity": 0.0,
    "linkType": 0,
    "customDouble1": 3.5,
    "customInt2": 0,
    "worktimeChainId": null,
    "invoiceStatus": 0,
    "customInt1": 0,
    "valueProfileId": null,
    "linkedObjectType": -1,
    "invoice": false,
    "planningFactor": 1.0,
    "customBoolean1": false,
    "linkedObjectId": null,
    "progressEmptying": 0.0,
    "calculatePriceRealised": false,
    "selectedResourceId": "120",
    "progressFillup": 0.0,
    "fillUpTime": 0.0,
    "invoicedDate": null,
    "nextOpNum": 0,
    "preferredResourceId": null,
    "baseManpower": 1.0,
    "progressSwitchOver": 0.0,
    "invoiceSum": 0.0,
    "siteId": null,
    "label": "30",
    "state": 30,
    "name": "120",
    "type": -2,
    "id": "852509_30_0_2_120",
    "tags": null,
    "anchor": 0,
    "opNum": 30,
    "locked": false
  },
  {
    "showBrokenConstraintFlag": false,
    "useCapacityFromResource": false,
    "subOperationRespectParentCalendar": false,
    "subOperationParentLinkStep": null,
    "newRouteOnChangeResource": false,
    "progressHoursWorkloadExtra": 0.0,
    "useValueProfileFromResource": true,
    "quantityFactorDisplayedReciproc": true,
    "respectResourceCalendar": true,
    "description": null,
    "customText2": "2",
    "customText4": "2;1;5;",
    "templateOperationId": "120",
    "customText1": "0",
    "groupIndex": -1,
    "unburdenResource": false,
    "previousQueueTime": 0.0,
    "quantityOnOutput": true,
    "disabled": false,
    "targetCapacity": 4.0,
    "postQueueTime": 24.0,
    "instanceType": 0,
    "useOverlap": false,
    "displayType": 0,
    "operationSequenceId": "_852056",
    "capacityOnOutput": false,
    "workload": 18.75,
    "allowEndBeforeThisEnd": false,
    "setupTime": 5.0,
    "startCalendar": "2023-02-15T22:46:00Z",
    "quantity": 0.0,
    "endCalendar": "2023-02-20T06:21:00Z",
    "materialCalendar": null,
    "progressInHours": 0.0,
    "mainType": 0,
    "options": 0,
    "targetWorkload": 15.0,
    "baseline1End": "2023-02-20T06:21:00Z",
    "switchOverTime": 0.0,
    "quantityFactor": 1.0,
    "overlapCount": 0.0,
    "duration": 1125.0,
    "overlapPercent": 0.0,
    "actualStartCalendar": null,
    "subOperationParentId": null,
    "actualEndCalendar": null,
    "wasteFactor": 0.0,
    "overlapValue": 0.0,
    "deliveryCalendar": null,
    "subOperationUpdateType": "WORKLOAD",
    "workloadType": 1,
    "overlapFixed": false,
    "quantityFinished": 0.0,
    "progressCalendar": null,
    "referenceEndCalendar": null,
    "workloadFactor": 1.0,
    "efficiency": 1.0,
    "capacity": 4.0,
    "transportTime": 0.0,
    "baseline1Start": "2023-02-15T22:46:00Z",
    "opLevel": 3,
    "progressQuantity": 0.0,
    "accountNumber": null,
    "customBoolean2": false,
    "endAnchor": 30,
    "remainingTimeRule": -1,
    "properties": "JobStatus\u003d0,0",
    "endAnchorType": 0,
    "emptyingTime": 0.0,
    "progressSetup": 0.0,
    "progressWorkload": 0.0,
    "progressScrapQuantity": 0.0,
    "linkType": 0,
    "customDouble1": 5.0,
    "customInt2": 0,
    "worktimeChainId": null,
    "invoiceStatus": 0,
    "customInt1": 0,
    "valueProfileId": null,
    "linkedObjectType": -1,
    "invoice": false,
    "planningFactor": 1.0,
    "customBoolean1": false,
    "linkedObjectId": null,
    "progressEmptying": 0.0,
    "calculatePriceRealised": false,
    "selectedResourceId": "120",
    "progressFillup": 0.0,
    "fillUpTime": 0.0,
    "invoicedDate": null,
    "nextOpNum": 0,
    "preferredResourceId": null,
    "baseManpower": 1.0,
    "progressSwitchOver": 0.0,
    "invoiceSum": 0.0,
    "siteId": null,
    "label": "30",
    "state": 30,
    "name": "120",
    "type": -2,
    "id": "852056_30_0_2_120",
    "tags": null,
    "anchor": 0,
    "opNum": 30,
    "locked": false
  }
]

I wish you’d told us that before. That’s much easier to work with than what’s in your original post. Now, what is it you want — first five characters of the id using which date field as comparison?

For example, you could pull that response into a rest sensor, and use something like this as a template:

{{ value_json
   |selectattr('startCalendar','<',now().date()|string)
   |map(attribute='id')
   |map('truncate',length=5,end='')
   |list }}

which will give a list of ids truncated to 5 digits where startCalendar is in the past.

Generating something like a markdown card from that should easy, but let’s get an exact description of what you’re after first.

1 Like

Correct. I need all ID’s stripped for the underscore. So the ID = 8XXXXX
I assume, I can create 2 sensors, so the ID’s in the past is in one sensor, and ID’s from today is in another sensor. Then I can create a card showing these.

Was I right about startCalendar?

That’s six characters.

The template above will return e.g. ["80001", "80002", "80042"]. You can them code up a markdown card like this (but with your sensor name instead of the input_text I’m using). I use the HA Alert to get the red background.

image

type: markdown
content: |-
  {% for i in (states('input_text.test123'))|from_json %}
    <ha-alert alert-type="error">{{ i }}</ha-alert>
  {% endfor %}

Yes: should be clear how to do that — the template above pulls past ones, and just change the '<' for 'eq' to get today’s (EDIT: '>' because we’re comparing a date with a datetime).

The ID is found in OperationSequenceID. It’s labeled _8XXXXX and I need to strip the _

StartCalendar is assumed correct.

Sorry for being a NOOB here. But I cannot find out the correct way to phase this :slight_smile:

resource_template: http://10.15.40.127:9999/scheduler/v1/plan/operations?filter=opr_state_level%20eq%2030&filter=opr_start_time%20lt%20{{ now().strftime("%Y-%m-%d") }}T00%3A00%3A00Z&filter=resource_id%20%20eq%20120
  scan_interval: "60"
  sensor:
    - name: "Resource_120_rest"
        {{ value_json
    |selectattr('startCalendar','<',now().date()|string)
    |map(attribute='id')
    |map('truncate',length=5,end='')
    |list }}

rest:
  - resource_template: http://10.15.40.127:9999/scheduler/v1/plan/operations?filter=opr_state_level%20eq%2030&filter=opr_start_time%20lt%20{{ now().strftime("%Y-%m-%d") }}T00%3A00%3A00Z&filter=resource_id%20%20eq%20120
    scan_interval: "60"
    sensor:
      - name: "Resource_120_rest"
        value_template: >
          {{ value_json
             |selectattr('startCalendar','<',now().date()|string)
             |map(attribute='id')
             |map('truncate',length=5,end='')
             |list }}

That’s taking the first five characters of the ID (as per your first few posts): if you want six, change the length=5 accordingly.

Alternatively, you could remove the truncate line completely to retrieve the full id, then cut it down in the card:

    <ha-alert alert-type="error">{{ i.split('_')[0] }}</ha-alert>

The Rest sensor works fine: Trying to get the Markdown to work with no luck:

type: markdown
content: |-
  {% for i in (states('input_text.resouce_123_rest'))|from_json %}
    <ha-alert alert-type="error">{{ i }}</ha-alert>
  {% endfor %}

You need to put the proper sensor name in and spell it correctly:

{% for i in (states('sensor.resource_120_rest'))|from_json %}

Still same result. It’s just blank

type: markdown
content: |-
  type: markdown
  content: |-
    {% for i in (states('sensor.resource_120_rest'))|from_json %}
      <ha-alert alert-type="error">{{ i }}</ha-alert>
    {% endfor %}

The rest returns
[‘848760’, ‘852509’, ‘852514’, ‘852080’]

Please post a screenshot of the states page for that sensor, like this, but for your sensor: