11
Ambient Weather and Ecowitt and other Fine Offset clones / Re: Trying to understand the details in Ecowitt JSON output
« Last post by jbroome on Today at 05:42:27 AM »If you use the browser interface to your GW* device, go to the Live Data page, then select "view source" to look at the HTML.
If you scroll down far enough, you should find something like this:
const idObj = {
'0x02': 'Outdoor Temperature',
'0x07': 'Outdoor Humidity',
'0x03': 'Dew Point',
// '0x04': 'Wind chill',
// '0x05': 'Heat index',
'0x0A': 'Wind Direction',
'0x0B': 'Wind Speed',
'0x0C': 'Gust Speed',
'0x15': 'Solar Irradiance',
'0x16': 'UV',
'0x17': 'UV-Index',
'0x18': 'Date and time',
'0x19': 'Day Wind Max',
'0x0D': 'Rain Event',
'0x0E': 'Rain Rate',
'0x0F': 'Rain hour',
'0x10': 'Rain Day',
'0x11': 'Rain Week',
'0x12': 'Rain Month',
'0x13': 'Rain Year',
'0x14': 'Rain Totals',
//piezo rain
// '0x80': 'Rain Rate',
// '0x81': 'Rain Event',
// '0x82': 'Rain Hour',
// '0x83': 'Rain Day',
// '0x84': 'Rain Week',
// '0x85': 'Rain Month',
// '0x86': 'Rain Year',
}
Also take a look at the function initData() - this is the top of it:
function initData() {
if (dataArr.common_list && dataArr.common_list.length > 0) { //common-data
let commonStr = ''
dataArr.common_list.forEach(val => {
let idStr = ''
if (val.id === '3') {
idStr = 'Feels Like'
} else if (val.id === '4') {
idStr = 'Apparent'
} else if (val.id == '0x0A') {
idStr = idObj[val.id] || ''
val.val = `${val.val} °`
} else if (val.id == '0x15') {
idStr = idObj[val.id] || ''
val.val = val.val.includes('W/m2') ? val.val.replace('W/m2', ' W/㎡') : `${val.val}`
} else {
idStr = idObj[val.id] || ''
}
if (val.id != '0x04' && val.id != '0x05') {
let unit = val.unit ? unitJudge(val.unit) : ''
let imgStr = (!val.battery || val.battery == '0') ? '' :
`<img src="${battImgobj[val.battery]}" >`
commonStr += `<div class="data-item">
<div class="data-til-box"><div class="data-til">${idStr}</div> ${imgStr}</div>
<div class="data-num">${val.val} ${unit}</div>
</div>`
}
})
This should help to decode the id values - at least *if* the value you seek is present.
Based on what I see, id "3" is indeed "Feels Like", id "4" is "Apparent", while "0x03" is "Dew Point" and "0x04" might be "Wind chill".
Gotta love how those ids are numerically equal, but not string equal...
---Jonathan
If you scroll down far enough, you should find something like this:
const idObj = {
'0x02': 'Outdoor Temperature',
'0x07': 'Outdoor Humidity',
'0x03': 'Dew Point',
// '0x04': 'Wind chill',
// '0x05': 'Heat index',
'0x0A': 'Wind Direction',
'0x0B': 'Wind Speed',
'0x0C': 'Gust Speed',
'0x15': 'Solar Irradiance',
'0x16': 'UV',
'0x17': 'UV-Index',
'0x18': 'Date and time',
'0x19': 'Day Wind Max',
'0x0D': 'Rain Event',
'0x0E': 'Rain Rate',
'0x0F': 'Rain hour',
'0x10': 'Rain Day',
'0x11': 'Rain Week',
'0x12': 'Rain Month',
'0x13': 'Rain Year',
'0x14': 'Rain Totals',
//piezo rain
// '0x80': 'Rain Rate',
// '0x81': 'Rain Event',
// '0x82': 'Rain Hour',
// '0x83': 'Rain Day',
// '0x84': 'Rain Week',
// '0x85': 'Rain Month',
// '0x86': 'Rain Year',
}
Also take a look at the function initData() - this is the top of it:
function initData() {
if (dataArr.common_list && dataArr.common_list.length > 0) { //common-data
let commonStr = ''
dataArr.common_list.forEach(val => {
let idStr = ''
if (val.id === '3') {
idStr = 'Feels Like'
} else if (val.id === '4') {
idStr = 'Apparent'
} else if (val.id == '0x0A') {
idStr = idObj[val.id] || ''
val.val = `${val.val} °`
} else if (val.id == '0x15') {
idStr = idObj[val.id] || ''
val.val = val.val.includes('W/m2') ? val.val.replace('W/m2', ' W/㎡') : `${val.val}`
} else {
idStr = idObj[val.id] || ''
}
if (val.id != '0x04' && val.id != '0x05') {
let unit = val.unit ? unitJudge(val.unit) : ''
let imgStr = (!val.battery || val.battery == '0') ? '' :
`<img src="${battImgobj[val.battery]}" >`
commonStr += `<div class="data-item">
<div class="data-til-box"><div class="data-til">${idStr}</div> ${imgStr}</div>
<div class="data-num">${val.val} ${unit}</div>
</div>`
}
})
This should help to decode the id values - at least *if* the value you seek is present.
Based on what I see, id "3" is indeed "Feels Like", id "4" is "Apparent", while "0x03" is "Dew Point" and "0x04" might be "Wind chill".
Gotta love how those ids are numerically equal, but not string equal...
---Jonathan