From b1410e328c06df8cb3f234bad6c71aa6842c2040 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 24 Jun 2020 18:44:28 +0200 Subject: [PATCH] Remove stale MQTT JSON processing documentation (#13836) --- source/_docs/mqtt.markdown | 1 - source/_docs/mqtt/processing_json.markdown | 30 ---------------------- source/_integrations/mqtt.markdown | 1 - 3 files changed, 32 deletions(-) delete mode 100644 source/_docs/mqtt/processing_json.markdown diff --git a/source/_docs/mqtt.markdown b/source/_docs/mqtt.markdown index bc403b15b66..9ef86f4038a 100644 --- a/source/_docs/mqtt.markdown +++ b/source/_docs/mqtt.markdown @@ -23,6 +23,5 @@ For detailed setup instructions, please refer to the [MQTT broker](/docs/mqtt/br - [Birth and last will messages](/docs/mqtt/birth_will/) - [Testing your setup](/docs/mqtt/testing/) - [Logging](/docs/mqtt/logging/) -- [Processing JSON](/docs/mqtt/processing_json/) See the [MQTT example component](/cookbook/python_component_mqtt_basic/) how to integrate your own component. diff --git a/source/_docs/mqtt/processing_json.markdown b/source/_docs/mqtt/processing_json.markdown deleted file mode 100644 index 776ff37bd08..00000000000 --- a/source/_docs/mqtt/processing_json.markdown +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "Processing JSON" -description: "Instructions on how to process the MQTT payload." -logo: mqtt.png ---- - -The MQTT [switch](/integrations/switch.mqtt/) and [sensor](/integrations/sensor.mqtt/) platforms support processing JSON over MQTT messages and parsing them using JSONPath. JSONPath allows you to specify where in the JSON the value resides that you want to use. The following examples will always return the value `100`. - -| JSONPath query | JSON | -| -------------- | ---- | -| `somekey` | `{ 'somekey': 100 }` -| `somekey[0]` | `{ 'somekey': [100] }` -| `somekey[0].value` | `{ 'somekey': [ { value: 100 } ] }` - -To use this, add the following key to your `configuration.yaml`: - -```yaml -switch: - platform: mqtt - state_format: 'json:somekey[0].value' -``` -It is also possible to extract JSON values by using a value template: - -```yaml -switch: - platform: mqtt - value_template: '{% raw %}{{ value_json.somekey[0].value }}{% endraw %}' -``` - -More information about the full JSONPath syntax can be found [in their documentation](https://github.com/kennknowles/python-jsonpath-rw#jsonpath-syntax). diff --git a/source/_integrations/mqtt.markdown b/source/_integrations/mqtt.markdown index 7e15e1de438..510279eeef7 100644 --- a/source/_integrations/mqtt.markdown +++ b/source/_integrations/mqtt.markdown @@ -51,4 +51,3 @@ This allows you to connect to the MQTT broker with user `homeassistant` and pass - [Birth and last will messages](/docs/mqtt/birth_will/) - [Testing your setup](/docs/mqtt/testing/) - [Logging](/docs/mqtt/logging/) -- [Processing JSON](/docs/mqtt/processing_json/)