[RE-RELEASE] EcoWitt and Wittboy Weather Stations And Sensors (Local)

i didnt add the original aqi but did help mircoline refine it.. here is the fx. bolded is the new line to add airqualityindex

private Boolean attributeUpdateAQI(String val, Boolean pm25, String attribAqi, String attribAqiDanger, String attribAqiColor) {
//
// Conversions based on Air quality index - Wikipedia
//
BigDecimal pm = val.toBigDecimal();

BigDecimal aqi;

if (pm25) {
// PM2.5
if (pm < 12.1) aqi = convertRange(pm, 0.0, 12.0, 0, 50);
else if (pm < 35.5) aqi = convertRange(pm, 12.1, 35.4, 51, 100);
else if (pm < 55.5) aqi = convertRange(pm, 35.5, 55.4, 101, 150);
else if (pm < 150.5) aqi = convertRange(pm, 55.5, 150.4, 151, 200);
else if (pm < 250.5) aqi = convertRange(pm, 150.5, 250.4, 201, 300);
else if (pm < 350.5) aqi = convertRange(pm, 250.5, 350.4, 301, 400);
else aqi = convertRange(pm, 350.5, 500.4, 401, 500);
}
else {
// PM10
if (pm < 55) aqi = convertRange(pm, 0, 54, 0, 50);
else if (pm < 155) aqi = convertRange(pm, 55, 154, 51, 100);
else if (pm < 255) aqi = convertRange(pm, 155, 254, 101, 150);
else if (pm < 355) aqi = convertRange(pm, 255, 354, 151, 200);
else if (pm < 425) aqi = convertRange(pm, 355, 424, 201, 300);
else if (pm < 505) aqi = convertRange(pm, 425, 504, 301, 400);
else aqi = convertRange(pm, 505, 604, 401, 500);

// Choose the highest AQI between PM2.5 and PM10
BigDecimal aqi25 = (device.currentValue(attribAqi) as BigDecimal);
if (aqi < aqi25) aqi = aqi25;

}

String danger;
String color;

if (aqi < 51) { danger = "Good"; color = "3ea72d"; }
else if (aqi < 101) { danger = "Moderate"; color = "fff300"; }
else if (aqi < 151) { danger = "Unhealthy for Sensitive Groups"; color = "f18b00"; }
else if (aqi < 201) { danger = "Unhealthy"; color = "e53210"; }
else if (aqi < 301) { danger = "Very Unhealthy"; color = "b567a4"; }
else if (aqi < 401) { danger = "Hazardous"; color = "7e0023"; }
else { danger = "Hazardous"; color = "7e0023"; }

// lgk set airQualityIndex only if actual aqi not avg
if (attribAqi == "aqi") attributeUpdateNumber(aqi, "airQualityIndex", "AQI");

Boolean updated = attributeUpdateNumber(aqi, attribAqi, "AQI");

if (attributeUpdateString(danger, attribAqiDanger)) updated = true;
if (attributeUpdateString(color, attribAqiColor)) updated = true;

return (updated);
}

// ------------------------------------------------------------

private Boolean attributeUpdateCarbonDioxide(String val, String attribCo2) {

BigDecimal co2 = val.toBigDecimal();
return (attributeUpdateNumber(co2, attribCo2, "ppm"));
}

// ------------------------------------------------------------

1 Like

Thanks @kahn-hubitat, I had other concerns that I had convinced myself were all ok, but by a happy accident of comparing your code I realised Mirco had introduced an additional condition around a "HTML Enabled" setting, which meant I was only going to have Air Quality updated where users had enabled this HTML setting. I have now fixed this.

I also added a thankyou in the change log to you for your good work :slight_smile:

1 Like

@sburke781

I have a few soil moisture sensors that I had "let go" for a while (removed from use and forgot about during landscaping project.

I recently replaced batteries in them (luckily no issues w/corroding or anything) and the read-out on the Device page for the batteries isn't working well. I have three sensors:

2022-02-12 10_10_54-Chrome Main
2022-02-12 10_11_03-Chrome Main
2022-02-12 10_11_09-Chrome Main

All three have exactly the same Preferences:

Battery reporting in the Ecowitt all show as "Normal:"

Anything I can do about this to fix reporting on HE? All three have fresh rechargeable batteries in them, which IRRC worked OK in the past. I have to admit, it's been so long since I used these that I really don't remember how battery reporting was before...do I need to do anything to "refresh" them in the integration to get them to report better?

I was literally doing the same thing yesterday. I purchased my first one about a month ago and then received another 3 during the week. I'll admit I haven't looked up Mirco's documentation, but I assumed it related to the low and high voltage settings. I looked my batteries up and from what I could tell they ranged from 1.3 down to 0.9, but I could be wrong.... But I can only assume those settings don't make there way back onto the Gateway, so I still have some investigation to do.

1 Like

Thanks - pretty funny about the timing. :slight_smile:

And don't worry, it's not because I hang out outside your house and x-ray all your packages when they arrive. Really, I'm not doing that. (Heh, heh, heh...)

1 Like

It is funny about the timing :slight_smile: And I didn't see the delivery guy that dropped it off, so all that effort you went to in order to purchase the uniform was not needed.... :wink:

1 Like

This question may not be about the drivers per se, but that is where I noticed something odd. I currently only have a GW1000 Gateway and one WH51. soil humidity sensor. I successfully added the gateway and sensor to the WSPlus app. Once that was done, both populated to the other Ecowitt app. I installed these Ecowitt drivers on my devices hub and everything was fine. The next day I stared having additional devices show up both on my phone and in the Hubitat Devices list.

The Gateway and Kitchen Plant are the devices I have. Where did the Air Quality sensor2, Indoor Ambient Sensor and Water / Soil Temperature Sensor 4 Come from? I'm very confused. Can someone help me understand where these came from??

If this isn't the appropriate forum, kindly let me know where would be more appropriate and I will gladly delete and repost there. Thanks!

Happy for you to post here, you're seeing something odd in the HE devices, if it turns out to be unrelated to the drivers that's ok, others may benefit from knowing what the reason was if they see the same thing.

If it was just the Ambient Sensor I could kind of understand. I have one that is hard-wired into the side of the gateway and is there to measure indoor temperature, humidity and air pressure, compared to my outdoor weather stations. But the fact this and the other sensors, showed up days later is really odd, including an Air Quality sensor. I could also have understood with the Soil Moisture sensor if it was somehow paired to a different channel, but again, the other devices makes it seem like something else.

Could they be pairing from a neighbours setup? Would the gateway be close enough do you think to someone else who may have just purchased either a complete setup or some new sensors?

1 Like

That was my first thought, and could be very possible. Not that i know of, but that doesnt mean much. Ill ask in our neighborhood facebook group if anyone else is using ecowitt andnhas these devices. Interestingly, no weather station, just single devices. Do you know if there is a way to get them off my gateway, as they seem to be using a couple channels i'll eventually need? I definitely plan to add more including a full weather station.
Thanks!

That made me wonder if they already had a setup and were just adding to it....

Not from experience, let me see what I can find out...

Looks like you need to go into the WSView app and find the listing of sensors and click de-register. I think I remember seeing it in there. It may take a little while for it to disappear. I'm not sure how it will play out in HE, I have a feeling you can't delete the child devices, but let's see how you go de-registering them first.

1 Like

This is the site sensor that showed up in the app


And temperature sensor

The soil moisture sensor doesn't do temperature does it? I didn't see it show up separately until yesterday.

Just following up since the thread popped up. :slight_smile:

Were you able to figure anything out about the soil moisture sensors' battery reporting?

No, it's only showing moisture there on the dashboard, 44% for the Kitchen Plant. The PM 2.5 CH2 will be the Air Quality Sensor. If you want to remove them you need to go into the WS View app on your phone / tablet.

Must admit it did slip my mind. Let me take a quick look.

It should work if you adjust the min and max settings on the sensor device page. Mine have stayed at 100% for now. I may have cut off the max a little early at 1.2 on one of them. So if you find out the range for the batteries you are using you can adjust the settings in HE to match. It doesn't look like they are written batch to the gateway at all, which I can understand, it is just pushing the readings out rather than accepting commands coming in.

1 Like

Thanks for the info. I was relieved, when I saw your first reply I was thinking I was going to have to fire you...

:wink:

1 Like

I don't specifically see it, do you recommend a particular dashboard tile template for the WH51 soil moisture sensor?

EDIT
Is it possible to have a template for the lightening sensor? I will eventually be going to the whole weather station, but for the time being am just planning to add a lightening sensor to the gate way. it would be nice to have that on my dashboard as well .

Thanks!

I've been meaning to update the Templates documentation, it only appears to include a subset of the available templates. There is a link at the very end of the Readme in GitHub which refers to the more complete list, admittedly in a code-like form.

From this, I think you will be looking for 13 or 13B for the Soil Moisture sensor and 4 or 4B for the Lightning sensor. You can type these into the Tile HTML Template Preference Setting to have the HTML tile generated, for example:

image

@sburke781

I'm getting notified by hub that PWS in Ecowitt is being very demanding...taking up by far the most processing time on my hub:

Anything I can do to reduce the PWS chattiness? I originally had it set to combine sensors in a virtual array (been that way for ages). Turned that off, didn't have any effect as far as I can tell.

It might be ok. I'd need to look at it in more detail to be sure. If you have added some sensors recently that might be all it it. From memory I think every attribute update is included in that figure, so if you are getting more readings coming through that would increase the perceived load.