|
Post by anticiclone on Nov 1, 2019 19:02:59 GMT -8
Hello,
I'm just tried so many times how to publish data using PubNub and Freeboard. However, when I apply the command sudo python ThunderBoardIOT.Py, I get this message:
pi@raspberrypi:~/SDL_Pi_ThunderBoard_IOT $ sudo python ThunderBoardIOT.py Thunder Board present at address 0x02 Waiting for lightning - or at least something that looks like it ----------------- ThunderBoard IOT
SwitchDoc Labs Version: Pi003 -----------------
--------- noise_floor= 0 min_strikes= 1 indoor= False mask_disturber= True disp_lco= False Interrupt Count= 0 Publishing Data to PubNub time: 2019-11-02 01:49:15.367614 LastResult: None ----------------- Scheduled Jobs ----------------- Jobstore default: blinkLED (trigger: interval[0:00:05], next run at: 2019-11-02 01:49:21 -01) tick (trigger: interval[0:01:00], next run at: 2019-11-02 01:50:16 -01) publishLightningToPubNub (trigger: interval[0:02:00], next run at: 2019-11-02 01:51:16 -01) readLightningStatus (trigger: interval[1:00:00], next run at: 2019-11-02 02:49:16 -01) ----------------- Press Ctrl+C to exit Interrupt reason= 1 Noise level too high - adjusting Noise Found Publishing Data to PubNub time: 2019-11-02 01:49:18.161215 LastResult: Noise level too high - adjusting Tick! The time is: 2019-11-02 01:50:16.932603
But I should get something like this:
Publishing Data to PubNub time: 2018-01-02 09:06:48.105484 LastResult: None status.is_error False status.original_response [1, u'Sent', u'15149128082657315']
The question is, what am I doing wrong?
I hope you can help with this problem!
Thank you.
|
|
|
Post by SDL on Nov 2, 2019 9:11:57 GMT -8
Are you getting anything at PubNub? Look in there debugging section.
BP
|
|
|
Post by anticiclone on Nov 2, 2019 13:51:29 GMT -8
I just found out that the problem arises in the software instalation. When I apply the command sudo python ThunderBoardIOT.py, I get something like this:
Thunder Board present at address 0x02 Waiting for lightning - or at least something that looks like it ----------------- ThunderBoard IOT
SwitchDoc Labs Version: Pi003 -----------------
--------- noise_floor= 0 min_strikes= 1 indoor= False mask_disturber= True disp_lco= False Interrupt Count= 0 Publishing Data to PubNub time: 2019-11-02 20:28:42.046687 LastResult: None ----------------- Scheduled Jobs ----------------- Jobstore default: blinkLED (trigger: interval[0:00:05], next run at: 2019-11-02 20:28:48 -01) tick (trigger: interval[0:01:00], next run at: 2019-11-02 20:29:43 -01) publishLightningToPubNub (trigger: interval[0:02:00], next run at: 2019-11-02 20:30:43 -01) readLightningStatus (trigger: interval[1:00:00], next run at: 2019-11-02 21:28:43 -01)
However, I should get this output:
Thunder Board present at address 0x02 Waiting for lightning - or at least something that looks like it ----------------- ThunderBoard IOT
SwitchDoc Labs Version: Pi003 -----------------
--------- noise_floor= 0 min_strikes= 1 indoor= False mask_disturber= False disp_lco= False Interrupt Count= 0 Publishing Data to PubNub time: 2017-12-15 10:56:37.356400 LastResult: None status.is_error False status.original_response [1, u'Sent', u'15133641978352182'] ----------------- Scheduled Jobs ----------------- Jobstore default: blinkLED (trigger: interval[0:00:05], next run at: 2017-12-15 10:56:43 PST) tick (trigger: interval[0:01:00], next run at: 2017-12-15 10:57:38 PST) publishLightningToPubNub (trigger: interval[0:02:00], next run at: 2017-12-15 10:58:38 PST) readLightningStatus (trigger: interval[1:00:00], next run at: 2017-12-15 11:56:38 PST) ----------------- Press Ctrl+C to exit Interrupt reason= 8 Lightning! 5km away.10:56:55 - 2017/12/15 PST Interrupt reason= 4 Publishing Data to PubNub time: 2017-12-15 10:56:56.766724 LastResult: Disturber detected - masking status.is_error False
What am I doing wrong?
THank you!
|
|
|
Post by SDL on Nov 3, 2019 7:09:20 GMT -8
Are you getting anything at PubNub? Look in there debugging section.
You aren't getting a callback, so I would guess you have the configuration keys wrong or something is wrong at PubNub.
BP
|
|
|
Post by anticiclone on Nov 3, 2019 7:50:10 GMT -8
![]() Hello, That's my debugging section. I have confirmed and my publish key and my subscribe key from PubNUb were correctly inserted in the dashboard.json file (which was imported into freeboard site later). Attachments:
|
|
|
Post by SDL on Nov 3, 2019 9:10:50 GMT -8
Open up another terminal window and do "sudo python listen.py" from your IOT directory.
then go back into the first and start the main IOT program.
Do you see any packets?
BP
|
|
|
Post by anticiclone on Nov 3, 2019 17:49:18 GMT -8
What I know is that the original ThunderBoard_IOT file seemed to be wrong, as it showed me the attribute error attached. ![]()  After a search on the Internet, I found out that the solution was deleting ". async (publish_callback)". And the error disappeared. The problem is that I can not get the output I should... Is it because I deleted that attribute? Thank you, once more!
|
|
|
Post by SDL on Nov 3, 2019 18:11:37 GMT -8
Anticlone,
That is a known problem of the new Pubnub release. They removed that for some reason and broke dozens of programs.
Post the code around the attribute that you deleted and let me check it.
BP
|
|
|
Post by anticiclone on Nov 4, 2019 7:16:04 GMT -8
Hi, I did what you suggested and the output I get is this:
----------------- ThunderBoard IOT
SwitchDoc Labs Version: Pi003 -----------------
--------- noise_floor= 0 min_strikes= 1 indoor= False mask_disturber= False disp_lco= False Interrupt Count= 0 Publishing Data to PubNub time: 2019-11-04 14:13:21.744011 LastResult: None Traceback (most recent call last): File "ThunderBoardIOT.py", line 291, in <module> publishLightningToPubNub() File "ThunderBoardIOT.py", line 261, in publishLightningToPubNub pubnub.publish().channel('my_channel').message(myMessage).async(publish_callback) AttributeError: 'Publish' object has no attribute 'async'
Thank you
|
|
|
Post by SDL on Nov 4, 2019 17:31:22 GMT -8
Remove ".async(publish_callback)" from Line 261.
Your program hasn't even started running yet.
BP
|
|
|
Post by anticiclone on Nov 5, 2019 8:55:16 GMT -8
Ok, i get this output now:
ThunderBoard IOT
SwitchDoc Labs Version: Pi003 -----------------
--------- noise_floor= 0 min_strikes= 1 indoor= False mask_disturber= False disp_lco= False Interrupt Count= 0 Publishing Data to PubNub time: 2019-11-05 15:54:08.321042 LastResult: None ----------------- Scheduled Jobs ----------------- Jobstore default: blinkLED (trigger: interval[0:00:05], next run at: 2019-11-05 15:54:14 -01) tick (trigger: interval[0:01:00], next run at: 2019-11-05 15:55:09 -01) publishLightningToPubNub (trigger: interval[0:02:00], next run at: 2019-11-05 15:56:09 -01) readLightningStatus (trigger: interval[1:00:00], next run at: 2019-11-05 16:54:09 -01) ----------------- Press Ctrl+C to exit
What is the next step?
|
|
|
Post by SDL on Nov 5, 2019 17:13:54 GMT -8
Are you running the listen.py program in another window?
BP
|
|
|
Post by anticiclone on Nov 5, 2019 17:38:25 GMT -8
No, I am not
|
|
|
Post by SDL on Nov 6, 2019 9:19:46 GMT -8
|
|
|
Post by anticiclone on Nov 7, 2019 6:19:58 GMT -8
No, I can't see any packets. I am now being supported by PubNub Support Team, as you say the problem is probably about PubNub activation. So I believe I can solve this situation. If not, I will try again through this forum.
PS: The link in your last message is about our conversation about this situation in the forum, in which I followed all the instructions you already gave me.
|
|