I am struggling to do something simple with the MQTT node: Get the cheerlights feed directly from Thingspeak. I can get it without problem from iot.eclipse.org but cannot seem to find the correct setup of the Thingspeak broker node.
The server is mqtt.thingspeak.com, port 1883.
Security is a random username and my API key.
The messages tab is left blank (I think).
The Topic is "channels/1417/subscribe/fields/field1" with QoS = 0.
It's probably something simple, but I'm just not seeing it. The result is always "disconnected" which, according the the Thingspeak MQTT documentation is the consequence of "Invalid subscription details such as API Key, channel number, or MQTT User API Key result in the client being disconnected."
Where am going wrong?
Thanks.
Hi - you made it here
This is my MQTT Node
Does that match up with yours?
Simon
Yes, it does. But it works now that I replaced my User API key with my MQTT API key. Doh. Like I said, it had to be something simple!
Thanks for taking the time!
--Jeff
No problem - glad to help out
On a separate note, I've had reliability issues in the past with this MQTT feed, which is why I've don't use it as my main source of cheerlights info
I parse the main http://api.thingspeak.com/channels/1417/feed.json instead and update my cheerlights feed based on changes in it
AFAIK the Thingspeak mqtt broker only supports QOS 0 so I think its inherently not reliable as it doesn't have to deliver all msgs to all listening clients.
I am probably going to switch over to using AndySCs feed at iot.eclipse.org (now that he's removed the non-standard black ) but just need to run a few tests to see if it follows the main cheerlights feed.json
Simon
it does... it's fed off an official web hook notification feed directly from ThingSpeak
The things you gods can do
I think tomorrow I be mainly removing 30 nodes from my cheerlights flows
Well then, I will follow the crowd of experienced people over to eclipse. I only went digging for the Thingspeak info because of the black, which AndySC has so kindly removed. So we're all good here and I learned something (and continue to do so). My ESP Cheerlight is now based off of Dr Lucy's code (because she programs waaaay better than I will ever) and I don't need to filter the stream or poll Thingspeak for anything. Simplify, simplify, simplify.
And I just thought of an interesting project: use a Raspberry Pi to send DMX commands to a mini-DMX LED floodlight using Node Red...
But I should really go back to paying attention to my day job .
@andysc While your here - could I talk about the iot.eclipse.com vs main Thingspeak API output (http://api.thingspeak.com/channels/1417/feed.xml or http://api.thingspeak.com/channels/1417/feed.json)
If I do a triple tweet e.g @cheerlights red green blue - somethimes Thingspeak API will sometimes not output one of the colours - but your feed catches them all and outputs them in correct sequence 30 secs apart
How does your webhook get colours that Thingspeak misses?
It's not a real practical issue obviously as the next single colour tweet will sort it out but I've always been interested in why the difference
Simon
Do you mean it doesn't appear in the feed at all, or you don't catch it by polling and looking at the last item on the feed?
They come through quickly, so you'd be hard pushed to poll fast enough to catch them all.
That's why we have MQTT
I get three callbacks on the web-hook (one for each colour) and then queue them up with a delay node for nicely-paced delivery to MQTT devices.
If you mean the history feed omits some of the entries, that's a question for @scharler
And also - thingspeak does not necessarily output the coluors in the order they appear in the tweet - whereas your feed does.[edit] subsequent tests prove that neither feeds follow the colour order all of the time![/edit]
Which makes me think you are doing your own twitter parsing (or something) and not outputting the One True Cheerlight Colour xkcd/927 again
I posted that at same time as your post!
I'm not asking all this on behalf of myself BTW - I'm asking for a Martian friend who wonders why some of the cheerlights they can see thru their telescopes are not the same as the others
Double output from Twitter node... deleted -- off topic. Will re-post as a new topic.
I only pass through what I receive from the web-hook callback from ThingSpeak. I do not parse the twitter feed myself.
I have to say, I've never seen the colours coming through out of order, and I have spent a LOT of time watching them
welll.........and it might be me but........
Sent this tweet
and your feed sent out
red
green
blue
yellow
pink
magenta
purple
orange
cyan
and the main cheerlight api sent out
At least you got them all
Now, in practical terms , for 99.9% use cases, getting the wrong order (or missing some out) doesn't matter
But the [edit]possible[/edit]difference in the final colour does cause my OCD to kick in
[edit] noticed that in this test you both agree on final colour but I don't think that is not always true)[/edit]
Now although both feeds have differences, I believe that the Cheerlights API is right because it is the Cheerlights API.
Rule 1 of cheerlights is that Cheerlights API is right
Like I say, it only effects people up on the ISS and my Martian friends
But it could spoil the look of a street come Christmas (if a lot of geeks live in it)
Simon
Just did another one (that shows that difference in last cheerlight)
yours (perfect this time BTW )
white
orange
purple
pink
magenta
cyan
yellow
blue
green
red
Cheerlight API
And yes - I need to get out more
Andy forwarded me this thread. CheerLights has some unique handling at ThingSpeak. We will make changes in September that will fix this issue.
And we will thank you for it (I'd wager).
Like cymplecy, I need to get out more often too. I have spent way too much time on this in the last week. But I have some more ideas I want to try out...
As they say, When the Student is Ready, the Teacher[s] will Appear.