You should really set the alarm in whatever program is sourcing pm2_5_cf_1.

The alarm extension works by examining the record after it has been
processed by the engine's pipeline. If something is not in the pipeline,
it's not going to be aware of it.

I suppose you could write a custom alarm that does a database lookup and
sounds an alarm on the basis of that. Little odd, but it would work. In any
case, that's not the way alarm.py works.

-tk

On Tue, Aug 25, 2020 at 9:59 AM Rahul Bedi <[email protected]> wrote:

> It appears that I might have to actually read the last record from the
> purpleair DB as the default record passed to the new_archive_record()
> handler in alarm.py is referring to the main weather station record only.
>
> Any tips on how to do the equivalent the following from the skin template
> within the alarm.py code:
>
> "$current($data_binding='aqi_binding').aqi_pm2_5"
>
> Thx.
>
> - Rahul
>
> On Tue, Aug 25, 2020 at 8:28 PM Rahul Bedi <[email protected]> wrote:
>
>> The expression I am trying to eval is:
>>
>> "(pm2_5_cf_1 > 0)"
>>
>> and the error is get is:
>>
>> "weewxd: alarm: name 'pm2_5_cf_1' is not defined"
>>
>> When I print it, here is what the record contains:
>>
>> Record:
>> {'heatindex': 82.0, 'altimeter': 27.113450189583336, 'outHumidity': 56.4,
>> 'humidex': 90.06778137338245, 'ET': None, 'rainBatteryStatus': 0.0,
>> 'rainFault': 0.0, 'uvFault': 0.0, 'rainRate': 0.0, 'outTempBatteryStatus':
>> 0.0, 'rain24': 0.0, 'inHeatindex': 28.333333333333343, 'inDewpoint':
>> 62.24454757159945, 'hourRain': 0.0, 'inTemp': 82.20137931034483,
>> 'barometer': 30.003354552125, 'windchill': None, 'dewpoint':
>> 63.195132514044566, 'windrun': 0.44117464302136283, 'rain': 0.0,
>> 'maxSolarRad': None, 'pressure': 27.113450189583336, 'windGustDir': 247.5,
>> 'rainTotal': 20.6502, 'clockUnsynchronized': 0.0, 'forecastIcon': 2.0,
>> 'usUnits': 1, 'appTemp': 81.67662896111341, 'windBatteryStatus': 0.0,
>> 'interval': 5, 'dateTime': 1598108100, 'windDir': 257.4427276349679,
>> 'outTemp': 80.13199999999999, 'windSpeed': 5.294095716256354, 'inHumidity':
>> 51.0, 'outTempFault': 0.0, 'windGust': 17.000758074738712,
>> 'uvBatteryStatus': 0.0, 'windFault': 0.0, 'cloudbase': 6765.2880649898725}
>>
>> None of the purple air fields are in it. Purpleair service does use a
>> different binding and database to store its values, so not sure if that has
>> some bearing.
>>
>> - Rahul
>>
>> On Tue, Aug 25, 2020 at 8:15 PM Tom Keffer <[email protected]> wrote:
>>
>>> I guess I don't understand. If the Purple Air fields are not in the
>>> record, where are they?
>>>
>>> On Tue, Aug 25, 2020 at 7:11 AM Rahul Bedi <[email protected]>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am trying to use the "examples/alarm.py" example in weewx 4.1.1 to
>>>> send me an email but instead of using the main weather record fields in the
>>>> expression eg. rainRate etc.. I would like to use fields from the purpleair
>>>> service but the expression is unable to eval them as they don't exist in
>>>> the record being passed to the "new_archive_record()" function.
>>>>
>>>> Any idea how I could refer to those ?
>>>>
>>>> Thanks.
>>>>
>>>> - Rahul
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "weewx-user" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/weewx-user/5c2eca8a-00e1-4499-8936-f77856931b89n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/weewx-user/5c2eca8a-00e1-4499-8936-f77856931b89n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "weewx-user" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/weewx-user/_8gBsgz9Qmc/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/weewx-user/CAPq0zEDjk91EAUt-zi%3DnfVccFA6vbpzMMy8b4dzsPRPbVcetwg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/weewx-user/CAPq0zEDjk91EAUt-zi%3DnfVccFA6vbpzMMy8b4dzsPRPbVcetwg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/CAJCGUpqeAXNiqtM0pYTw1fyDXCTdY3c8YnRqEAz9CsBhABA%3DgQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/weewx-user/CAJCGUpqeAXNiqtM0pYTw1fyDXCTdY3c8YnRqEAz9CsBhABA%3DgQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEB09buQp8btPOeyWzt7QitnZa2kD6TmkrDjAL%3DCXBRraA%40mail.gmail.com.

Reply via email to