Hi,
This is my first post because I haven’t been able to find an answer elsewhere on this great forum.
I try to get data from this json file into home assistant, but I keep getting ‘value_json’ is undefined in Template editor under Developer tools.
- platform: rest
name: ups_data
resource: https://172.16.1.14:8888/0/json
scan_interval: 5
verify_ssl: false
value_template: "{{value_json[0].batCapacity}}
value_template: 'OK'
- platform: template
sensors:
ups_batcapacity:
value_template: '{{ states.sensor.ups_data["batCapacity"] }}'
friendly_name: "UPS Batcapacity"
I would like to have so I can see this data in Home Assistant:
“batCapacity”: “100%”
“inVolt”: “228.0V”
“loadPercent”: “20%”
“batTimeRemain”: “32m3s”
“outVolt”: “229.0V”
“batV”: “27.1V”
This is the raw file from my UPS website
{“key”:“USB/LINE-INT_000000000”,“device”:{“key”:“USB/LINE-INT_000000000”,“id”:0,“protocol”:4,“portIndex”:4,“ip”:null,“status”:“”,“upsIndex”:0,“hasWarn”:false,“statusIcon”:“online”},“version”:“”,“status”:“Normal”,“model”:“LINE-INT”,“warning”:“”,“inFreq”:“”,“outFreq”:“49.6Hz”,“emdHumidity”:“”,“batTemp”:“”,“batCapacity”:“100%”,“lsCounter”:-1,“oidType”:0,“inVolt”:“228.0V”,“loadPercent”:“20%”,“batTimeRemain”:“32m3s”,“bypassFreq”:“”,“outVolt”:“229.0V”,“noModule”:false,“workMode”:-1,“extStatus”:0,“bypassVolt”:“”,“iStatus”:0,“loadPercentMax”:20,“loadSegment1State”:“”,“loadSegment2State”:“”,“redundantNumber”:“”,“batV”:“27.1V”,“ls1”:-1,“ls2”:-1,“outA”:“”,“outVA”:“”,“outW”:“”,“lastEvent1”:“”,“abmState”:“”,“emdAlarm1”:“”,“emdTemp”:“”,“lastEvent2”:“22/01/2024 06:10:58 Start Agent”,“emdAlarm2”:“”,“cfgKVA”:“”,“cfgBatNumber”:“”,“upsTemp”:“”,“supportTest”:true,“statusColor”:0}
This is from JSON Online Validator
"key": "USB/LINE-INT_000000000",
"device": {
"key": "USB/LINE-INT_000000000",
"id": 0,
"protocol": 4,
"portIndex": 4,
"ip": null,
"status": "",
"upsIndex": 0,
"hasWarn": false,
"statusIcon": "online"
},
"version": "",
"status": "Normal",
"model": "LINE-INT",
"warning": "",
"inFreq": "",
"outFreq": "49.6Hz",
"emdHumidity": "",
"batTemp": "",
"batCapacity": "100%",
"lsCounter": -1,
"oidType": 0,
"inVolt": "228.0V",
"loadPercent": "20%",
"batTimeRemain": "32m3s",
"bypassFreq": "",
"outVolt": "229.0V",
"noModule": false,
"workMode": -1,
"extStatus": 0,
"bypassVolt": "",
"iStatus": 0,
"loadPercentMax": 20,
"loadSegment1State": "",
"loadSegment2State": "",
"redundantNumber": "",
"batV": "27.1V",
"ls1": -1,
"ls2": -1,
"outA": "",
"outVA": "",
"outW": "",
"lastEvent1": "",
"abmState": "",
"emdAlarm1": "",
"emdTemp": "",
"lastEvent2": "22/01/2024 06:10:58 Start Agent",
"emdAlarm2": "",
"cfgKVA": "",
"cfgBatNumber": "",
"upsTemp": "",
"supportTest": true,
"statusColor": 0
}
can anyone help me to make the right code?
Thanks,
Jesper