UK (Met Office) Pollen forecast

I have just posted this in the flows section



Pollen index should be;

pollen[index] = { day: (dayNames[(new Date().getDay() + index) % 7]), level: msg.payload[index] }
1 Like

I just noticed it was going past the end of the array, and came here to fix it along with a couple of other tweaks hoping nobody would notice :wink:

But you beat me to it!

At least I know someone looked at it Thanks :smiley:


On the pollen type branch of the flow you have a switch: msg.payload has key "length".

Can you explain what this is intended to filter out? For me it blocks the valid list of pollen types.

Sometimes there is no data for this, in that case the string nodes output an object like this -

payload: object

s: ""
orig: ""
length: 0

Since I didn't want this to display I added the switch node setup like this


However this passes every message to output 1 even without that key. I don't understand what I'm doing wrong here with the has key option ?

Any ideas why this doesn't work as I expected ?

I have changed the logic to test for length value of 0 so it works now, but would still like to know why switch setup above didn't work ?

Thnks for sharing this.

Yes it's a puzzle. I have not seen an invalid payload so far but this is a valid one at this stage in the flow: "Tree pollen currently includes ash, oak, plane and birch. Spores: Pleospora."
And that does, apparently, have a key "length" !

I don't think your usage instructions are quite right:

Visit the web site and select your region, note the region code in the address and modify the inject node and pollen type html node to match.

Since the HTTP Request node ignores msg.payload, the region code in inject is irrelevant. We have to change the code in both Pollen type and Level HTML nodes.

1 Like

I've put the region code ( as suggested by @jbudd ) in the HTML nodes... Pollen type and Level and the flow works fine now - it gives the same results (icons) as the Met Office website.

I will have a think about how I can make that a bit easier then :wink:

OK updated due to popular request :wink:

Region is now just added into the inject node.


Thanks for sharing, nice little addition to my daily forecast notification :slight_smile:

Glad it is of interest - be sure to rate in the flows section :rofl:

1 Like

This has been updated to include the VH pollen level :wink:

1 Like