Hello
I have stumbled in scrubbing the datapoints from a json reply. I want to get data from a json reply which answers like this -
Ask -http://192.168.39.14/app/config/0/1
Response -
"Code": 0,
"Result": {
"UpdateInterval": {
"EnMap": 0,
"Value": 10
},
"DataValidTime": {
"EnMap": 0,
"Value": 7
},
"Point": [{
"Name": "CAP_A",
"Unit": "%",
"Type": "unsigned",
"Value": 0,
"Writable": 0,
"EnMap": 1
}, {
"Name": "cap_av_a",
"Unit": "%",
"Type": "unsigned",
"Value": 0,
"Writable": 0,
"EnMap": 1
}, {
"Name": "DP_A",
"Unit": "KPa",
"Type": "float",
"Value": 1490.648560,
"Writable": 0,
"EnMap": 1,
"EnMapAdd": 0
}, {
"Name": "SP_A",
"Unit": "KPa",
"Type": "float",
"Value": 821.659912,
"Writable": 0,
"EnMap": 1,
"EnMapAdd": 0
}, {
"Name": "SCT_A",
"Unit": "°C",
"Type": "float",
"Value": 41.521896,
"Writable": 0,
"EnMap": 0,
"EnMapAdd": 2
}, {
"Name": "SST_A",
"Unit": "°C",
"Type": "float",
"Value": 20.516191,
"Writable": 0,
"EnMap": 0,
"EnMapAdd": 2
}, {
"Name": "DEFRT_A",
"Unit": "°C",
"Type": "float",
"Value": -17.777779,
"Writable": 0,
"EnMap": 0,
"EnMapAdd": 0
}, {
"Name": "speed_a",
"Unit": "%",
"Type": "unsigned",
"Value": 0,
"Writable": 0,
"EnMap": 0
}],
"RegStart": 15
}
}
type or paste code here
To get this - I am using the below in my yaml. Its not getting me past this error
end of the stream or a document separator is expected at line 10, column 4:
- name: "runstate"
^
My yaml-
rest:
- authentication: basic
username: "xx"
password: "xx"
scan_interval: 2
- resource: http://192.168.39.14/app/config/0/0
sensor:
- name: "ctr_type"
value_template: "{{ value_json.Point.0.Value }}"
- name: "runstate"
value_template: "{{ value_json.Point.1.Value }}"
- name: "CHIL_S_S"
value_template: "{{ value_json.Point.2.Value }}"
- name: "CHIL_OCC"
value_template: "{{ value_json.Point.3.Value }}"
- name: "min_left"
value_template: "{{ value_json.Point.4.Value }}"
- name: "ALM"
value_template: "{{ value_json.Point.7.Value }}"
- name: "CAP_T"
value_template: "{{ value_json.Point.13.Value }}"
- name: "SP"
value_template: "{{ value_json.Point.17.Value }}"
- name: "CTRL_PNT"
value_template: "{{ value_json.Point.18.Value }}"
- name: "CTRL_WT"
value_template: "{{ value_json.Point.19.Value }}"
- name: "OAT"
value_template: "{{ value_json.Point.20.Value }}"
- authentication: basic
username: "xx"
password: "xx"
scan_interval: 2
resource: http://192.168.39.14/app/config/0/1
sensor:
- name: "CP_A1"
value_template: "{{ value_json.Point.0.Value }}"
- name: "DP_A"
value_template: "{{ value_json.Point.2.Value }}"
- name: "SP_A"
value_template: "{{ value_json.Point.3.Value }}"
- name: "SCT_A"
value_template: "{{ value_json.Point.4.Value }}"
- name: "SST_A"
value_template: "{{ value_json.Point.5.Value }}"
Please help.