Page 1 of 1

How to get Lux value using bash curl command

Posted: Tuesday 16 April 2019 18:21
by vidin
hello I have problem with get Lux value
for example for voltage I use

Code: Select all

curl -s 'http://192.168.9.4:8080/json.htm?type=devices&rid=11' | jq .result[0].Voltage | sed 's/\"//g' | awk '{ print $1 }'
for Lux I try

Code: Select all

curl -s 'http://192.168.9.4:8080/json.htm?type=devices&rid=17' | jq .result[0].Lux | sed 's/\"//g' | awk '{ print $1 }'
curl -s 'http://192.168.9.4:8080/json.htm?type=devices&rid=17' | jq .result[0].Value | sed 's/\"//g' | awk '{ print $1 }'
curl -s 'http://192.168.9.4:8080/json.htm?type=devices&rid=17' | jq .result[0].VALUE | sed 's/\"//g' | awk '{ print $1 }'
curl -s 'http://192.168.9.4:8080/json.htm?type=devices&rid=17' | jq .result[0].LightLevel | sed 's/\"//g' | awk '{ print $1 }'
and command always return "null"

Re: How to get Lux value using bash curl command

Posted: Tuesday 16 April 2019 20:12
by waaren
vidin wrote: Tuesday 16 April 2019 18:21 hello I have problem with get Lux value
....
and command always return "null"
Try

Code: Select all

curl -s 'http://192.168.9.4:8080/json.htm?type=devices&rid=17' | grep Data | awk '{ print $3 }' | cut -b2-

Re: How to get Lux value using bash curl command

Posted: Tuesday 16 April 2019 20:24
by vidin
It works fine, thanks