From 8ed0590f1abdd3bf84b131a5cef05ee50e7d76c3 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 14 Feb 2020 13:06:30 -0600 Subject: [PATCH 01/19] xml and jsonpath support https://github.com/home-assistant/home-assistant/pull/31809 --- source/_integrations/rest.markdown | 32 +++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 69fbf37cc367..f796c5cec0c2 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -8,7 +8,7 @@ ha_release: 0.7.4 ha_iot_class: Local Polling --- -The `rest` sensor platform is consuming a given endpoint which is exposed by a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer) of a device, an application, or a web service. The sensor has support for GET and POST requests. +The `rest` sensor platform is consuming a given endpoint which is exposed by a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer) of a device, an application, or a web service. The sensor has support for GET and POST requests. To enable this sensor, add the following lines to your `configuration.yaml` file for a GET request: @@ -105,12 +105,16 @@ headers: required: false type: [string, list] json_attributes: - description: A list of keys to extract values from a JSON dictionary result and then set as sensor attributes. - reqired: false + description: A list of keys to extract values from a JSON dictionary result and then set as sensor attributes. If the endpoint returns XML with the text/xml content type, it will automatically be converted to JSON according to this specification: https://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html + required: false type: [string, list] +json_path_attributes: + description: A jsonpath (https://goessner.net/articles/JsonPath/) that refereances the location of the json_attributes in the json content. + required: false + type: string force_update: description: Sends update events even if the value hasn't changed. Useful if you want to have meaningful value graphs in history. - reqired: false + required: false type: boolean default: false {% endconfiguration %} @@ -252,7 +256,7 @@ sensor: - date - milliseconds_since_epoch resource: http://date.jsontest.com/ - value_template: '{{ value_json.time }}' + value_template: '{{ value_json.time }}' - platform: template sensors: date: @@ -264,6 +268,24 @@ sensor: ``` {% endraw %} +[JSONPlaceholder](https://jsonplaceholder.typicode.com/) provides sample JSON data for testing. In the below example, jsonpath locates the attributes in the JSON document. [JSONPath Online Evaluator](https://jsonpath.com/) provides a tool to test your jsonpath. If the endpoints returns XML, it will be converted to JSON using xmltodict before searching for attributes. + +{% raw %} +```yaml +sensor: + - platform: rest + name: JSON users + json_attributes_path: "$.[0].address" + json_attributes: + - street + - suite + - city + - zipcode + resource: https://jsonplaceholder.typicode.com/users + value_template: '{{ value_json.name }}' +``` +{% endraw %} + This sample fetches a weather report from [OpenWeatherMap](https://openweathermap.org/), maps the resulting data into attributes of the RESTful sensor and then creates a set of [template](/integrations/template) sensors that monitor the attributes and present the values in a usable form. {% raw %} From e682b9f9c370ffee0394bf8d21f841f106269467 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 14 Feb 2020 13:13:33 -0600 Subject: [PATCH 02/19] adjust for lint --- source/_integrations/rest.markdown | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index f796c5cec0c2..3ade376fda62 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -8,7 +8,7 @@ ha_release: 0.7.4 ha_iot_class: Local Polling --- -The `rest` sensor platform is consuming a given endpoint which is exposed by a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer) of a device, an application, or a web service. The sensor has support for GET and POST requests. +The `rest` sensor platform is consuming a given endpoint which is exposed by a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer) of a device, an application, or a web service. The sensor has support for GET and POST requests. To enable this sensor, add the following lines to your `configuration.yaml` file for a GET request: @@ -105,11 +105,11 @@ headers: required: false type: [string, list] json_attributes: - description: A list of keys to extract values from a JSON dictionary result and then set as sensor attributes. If the endpoint returns XML with the text/xml content type, it will automatically be converted to JSON according to this specification: https://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html + description: A list of keys to extract values from a JSON dictionary result and then set as sensor attributes. If the endpoint returns XML with the "text/xml" content type, it will automatically be converted to JSON according to this [specification](https://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html) required: false type: [string, list] json_path_attributes: - description: A jsonpath (https://goessner.net/articles/JsonPath/) that refereances the location of the json_attributes in the json content. + description: A [jsonpath](https://goessner.net/articles/JsonPath/) that refereances the location of the json_attributes in the JSON content. required: false type: string force_update: @@ -256,7 +256,7 @@ sensor: - date - milliseconds_since_epoch resource: http://date.jsontest.com/ - value_template: '{{ value_json.time }}' + value_template: '{{ value_json.time }}' - platform: template sensors: date: @@ -282,7 +282,7 @@ sensor: - city - zipcode resource: https://jsonplaceholder.typicode.com/users - value_template: '{{ value_json.name }}' + value_template: '{{ value_json.name }}' ``` {% endraw %} From 8c436a097d3a18d2f100bfd87f787c882862768d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 14 Feb 2020 13:19:12 -0600 Subject: [PATCH 03/19] grammar --- source/_integrations/rest.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 3ade376fda62..bbc60e09db95 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -268,7 +268,7 @@ sensor: ``` {% endraw %} -[JSONPlaceholder](https://jsonplaceholder.typicode.com/) provides sample JSON data for testing. In the below example, jsonpath locates the attributes in the JSON document. [JSONPath Online Evaluator](https://jsonpath.com/) provides a tool to test your jsonpath. If the endpoints returns XML, it will be converted to JSON using xmltodict before searching for attributes. +[JSONPlaceholder](https://jsonplaceholder.typicode.com/) provides sample JSON data for testing. In the below example, jsonpath locates the attributes in the JSON document. [JSONPath Online Evaluator](https://jsonpath.com/) provides a tool to test your jsonpath. If the endpoint returns XML, it will be converted to JSON using xmltodict before searching for attributes. {% raw %} ```yaml From 72cb8ccfb49a45a3d533ac9490337e4d20c659dc Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 21 Feb 2020 14:45:01 -1000 Subject: [PATCH 04/19] Fix xml conversion output, add a more complex example --- source/_integrations/rest.markdown | 109 ++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index bbc60e09db95..7de58df9c91a 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -282,7 +282,7 @@ sensor: - city - zipcode resource: https://jsonplaceholder.typicode.com/users - value_template: '{{ value_json.name }}' + value_template: '{{ value_json[0].name }}' ``` {% endraw %} @@ -380,3 +380,110 @@ sensor: unit_of_measurement: '°C' ``` {% endraw %} + +The below example allows shows how to extract multiple values from a dictionary with `json_attributes` and `json_attributes_path` from the XML of a Steamist Steambath WiFi interface and use them to create a switch and multiple sensors without having to poll the endpoint numerous times. + +{% raw %} +```yaml +sensor: +# Steam Controller + - platform: rest + name: Steam System Data + resource: http://192.168.1.105/status.xml + json_attributes_path: "$.response" + scan_interval: 15 + value_template: 'OK' + json_attributes: + - "usr0" + - "pot0" + - "temp0" + - "time0" + - platform: template + sensors: + steam_temp: + friendly_name: Steam Temp + value_template: '{{ states.sensor.steam_system_data.attributes["temp0"] | regex_findall_index("([0-9]+)XF") }}' + unit_of_measurement: "°F" + steam_time_remaining: + friendly_name: "Steam Time Remaining" + value_template: '{{ states.sensor.steam_system_data.attributes["time0"] }}' + unit_of_measurement: "minutes" + +switch: + - platform: template + switches: + steam: + value_template: '{{ states.sensor.steam_system_data.attributes["usr0"] | int >= 1 }}' + turn_on: + - service: rest_command.set_steam_led + data: + led: 6 + - service: homeassistant.update_entity + data: + entity_id: sensor.steam_system_data + - delay: 00:00:15 + - service: homeassistant.update_entity + data: + entity_id: sensor.steam_system_data + turn_off: + - service: rest_command.set_steam_led + data: + led: 7 + - service: homeassistant.update_entity + data: + entity_id: sensor.steam_system_data + - delay: 00:00:15 + - service: homeassistant.update_entity + data: + entity_id: sensor.steam_system_data + friendly_name: Steam + +rest_command: + set_steam_led: + url: http://192.168.1.105/leds.cgi?led={{ led }} + +``` +{% endraw %} + +For reference, the XML content of status.xml endpoint shown above example is below: + +{% raw %} +```xml + + + + 0 + 12556 + 48 + alexander + + + 0 + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + up + up + up + up + 0 + 0 + 0x73XF0x73XF + 0 + + + + +``` +{% endraw %} From 49c2b5fa3daac366a41934b3fee1c353ea10d653 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 21 Feb 2020 14:47:36 -1000 Subject: [PATCH 05/19] Update rest.markdown --- source/_integrations/rest.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 7de58df9c91a..673b93c78f80 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -445,7 +445,7 @@ rest_command: ``` {% endraw %} -For reference, the XML content of status.xml endpoint shown above example is below: +For reference, the XML content of endpoint shown above example is below: {% raw %} ```xml From de8d17bbc950fb087ce1bd8541ba8ec082660de5 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 21 Feb 2020 15:45:55 -1000 Subject: [PATCH 06/19] Added note about json_attributes_path --- source/_integrations/rest.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 673b93c78f80..6d9bef36f5e4 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -383,6 +383,8 @@ sensor: The below example allows shows how to extract multiple values from a dictionary with `json_attributes` and `json_attributes_path` from the XML of a Steamist Steambath WiFi interface and use them to create a switch and multiple sensors without having to poll the endpoint numerous times. +In the below example `json_attributes_path` is set to "$.response" which is the location of the the "usr0", "pot0", ... attributes used for `json_attributes`. + {% raw %} ```yaml sensor: From 6797d92e659f7357354bd26b800add468a72f553 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 04:58:42 -1000 Subject: [PATCH 07/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 6d9bef36f5e4..a03cab958de7 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -109,7 +109,7 @@ json_attributes: required: false type: [string, list] json_path_attributes: - description: A [jsonpath](https://goessner.net/articles/JsonPath/) that refereances the location of the json_attributes in the JSON content. + description: A [JSONPath](https://goessner.net/articles/JsonPath/) that references the location of the `json_attributes` in the JSON content. required: false type: string force_update: From 5b866c5844b1c942e5ab80abedabaf5432d1bfad Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 04:58:51 -1000 Subject: [PATCH 08/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index a03cab958de7..c57c2c3a9ef4 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -268,7 +268,7 @@ sensor: ``` {% endraw %} -[JSONPlaceholder](https://jsonplaceholder.typicode.com/) provides sample JSON data for testing. In the below example, jsonpath locates the attributes in the JSON document. [JSONPath Online Evaluator](https://jsonpath.com/) provides a tool to test your jsonpath. If the endpoint returns XML, it will be converted to JSON using xmltodict before searching for attributes. +[JSONPlaceholder](https://jsonplaceholder.typicode.com/) provides sample JSON data for testing. In the below example, JSONPath locates the attributes in the JSON document. [JSONPath Online Evaluator](https://jsonpath.com/) provides a tool to test your JSONPath. If the endpoint returns XML, it will be converted to JSON using `xmltodict` before searching for attributes. {% raw %} ```yaml From fc681dd4b6da13a9912a540407ab1801eb0b3c1a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 04:58:59 -1000 Subject: [PATCH 09/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index c57c2c3a9ef4..dffaad891fa7 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -284,6 +284,7 @@ sensor: resource: https://jsonplaceholder.typicode.com/users value_template: '{{ value_json[0].name }}' ``` + {% endraw %} This sample fetches a weather report from [OpenWeatherMap](https://openweathermap.org/), maps the resulting data into attributes of the RESTful sensor and then creates a set of [template](/integrations/template) sensors that monitor the attributes and present the values in a usable form. From 9f0609bb4b0601d43586589a6ffee9843563d2ad Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 04:59:08 -1000 Subject: [PATCH 10/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 1 - 1 file changed, 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index dffaad891fa7..4a6d83d7fe28 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -444,7 +444,6 @@ switch: rest_command: set_steam_led: url: http://192.168.1.105/leds.cgi?led={{ led }} - ``` {% endraw %} From 230d54e89fce5c5bc4dd1f717b5ade830098e255 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 04:59:16 -1000 Subject: [PATCH 11/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 4a6d83d7fe28..6df9f40d6ffb 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -445,6 +445,7 @@ rest_command: set_steam_led: url: http://192.168.1.105/leds.cgi?led={{ led }} ``` + {% endraw %} For reference, the XML content of endpoint shown above example is below: From 8a7c229569b8389a7e8289eb54a22c20447501af Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 04:59:41 -1000 Subject: [PATCH 12/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 1 - 1 file changed, 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 6df9f40d6ffb..fd9d5bf2ba6f 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -489,4 +489,3 @@ For reference, the XML content of endpoint shown above example is below: ``` -{% endraw %} From 28ae58412f361f6fe33406e5ee00f301a55ecb1a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 04:59:48 -1000 Subject: [PATCH 13/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 1 - 1 file changed, 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index fd9d5bf2ba6f..20e32ade98d4 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -450,7 +450,6 @@ rest_command: For reference, the XML content of endpoint shown above example is below: -{% raw %} ```xml From 8837953c3cf8f1c3b2a042c30643ba09241a5d3a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 05:00:01 -1000 Subject: [PATCH 14/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 20e32ade98d4..62812b2902ba 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -382,7 +382,7 @@ sensor: ``` {% endraw %} -The below example allows shows how to extract multiple values from a dictionary with `json_attributes` and `json_attributes_path` from the XML of a Steamist Steambath WiFi interface and use them to create a switch and multiple sensors without having to poll the endpoint numerous times. +The below example allows shows how to extract multiple values from a dictionary with `json_attributes` and `json_attributes_path` from the XML of a Steamist Steambath Wi-Fi interface and use them to create a switch and multiple sensors without having to poll the endpoint numerous times. In the below example `json_attributes_path` is set to "$.response" which is the location of the the "usr0", "pot0", ... attributes used for `json_attributes`. From 90c87aa5d7686405773ac4a20aff73073acd3ffd Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 05:00:09 -1000 Subject: [PATCH 15/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 62812b2902ba..e89014d865e0 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -271,6 +271,7 @@ sensor: [JSONPlaceholder](https://jsonplaceholder.typicode.com/) provides sample JSON data for testing. In the below example, JSONPath locates the attributes in the JSON document. [JSONPath Online Evaluator](https://jsonpath.com/) provides a tool to test your JSONPath. If the endpoint returns XML, it will be converted to JSON using `xmltodict` before searching for attributes. {% raw %} + ```yaml sensor: - platform: rest From 0823bad43af415e8d9f62ce0df811f4c43a69055 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 05:00:49 -1000 Subject: [PATCH 16/19] Update rest.markdown --- source/_integrations/rest.markdown | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index e89014d865e0..d2c5bb8f1694 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -459,7 +459,6 @@ For reference, the XML content of endpoint shown above example is below: 12556 48 alexander - 0 0 @@ -467,7 +466,6 @@ For reference, the XML content of endpoint shown above example is below: 0 0 - 0 0 0 @@ -484,8 +482,5 @@ For reference, the XML content of endpoint shown above example is below: 0 0x73XF0x73XF 0 - - - ``` From 5640bec1b7b1bc1da6e93249aee2f6bc3e323ba1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 05:01:04 -1000 Subject: [PATCH 17/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index d2c5bb8f1694..0898efc54c16 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -385,7 +385,7 @@ sensor: The below example allows shows how to extract multiple values from a dictionary with `json_attributes` and `json_attributes_path` from the XML of a Steamist Steambath Wi-Fi interface and use them to create a switch and multiple sensors without having to poll the endpoint numerous times. -In the below example `json_attributes_path` is set to "$.response" which is the location of the the "usr0", "pot0", ... attributes used for `json_attributes`. +In the below example `json_attributes_path` is set to `$.response` which is the location of the `usr0`, `pot0`, ... attributes used for `json_attributes`. {% raw %} ```yaml From ff7b88e06f270b7eeac61369fd9edbe7c4d8f054 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 05:01:11 -1000 Subject: [PATCH 18/19] Update source/_integrations/rest.markdown Co-Authored-By: Franck Nijhof --- source/_integrations/rest.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 0898efc54c16..31a02e6248d1 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -388,6 +388,7 @@ The below example allows shows how to extract multiple values from a dictionary In the below example `json_attributes_path` is set to `$.response` which is the location of the `usr0`, `pot0`, ... attributes used for `json_attributes`. {% raw %} + ```yaml sensor: # Steam Controller From 78c35600547aaf2c19b0644b86eab23c8dcbf3d7 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Feb 2020 05:03:35 -1000 Subject: [PATCH 19/19] Update rest.markdown --- source/_integrations/rest.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 31a02e6248d1..77cdd9402f27 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -268,7 +268,7 @@ sensor: ``` {% endraw %} -[JSONPlaceholder](https://jsonplaceholder.typicode.com/) provides sample JSON data for testing. In the below example, JSONPath locates the attributes in the JSON document. [JSONPath Online Evaluator](https://jsonpath.com/) provides a tool to test your JSONPath. If the endpoint returns XML, it will be converted to JSON using `xmltodict` before searching for attributes. +[JSONPlaceholder](https://jsonplaceholder.typicode.com/) provides sample JSON data for testing. In the below example, JSONPath locates the attributes in the JSON document. [JSONPath Online Evaluator](https://jsonpath.com/) provides a tool to test your JSONPath. If the endpoint returns XML, it will be converted to JSON using `xmltodict` before searching for attributes. You may find the [XMLtoDict debug tool](https://xmltodict-debugger.glitch.me/) helpful for testing how your XML converts to JSON. {% raw %}