Comments on: Chapter 12: The Internet of Things https://www.exploringrpi.com Companion Site for the book Exploring Raspberry Pi Fri, 27 Apr 2018 02:56:25 +0000 hourly 1 https://wordpress.org/?v=5.0.1 By: Gustavo https://www.exploringrpi.com/chapter12/#comment-291 Sat, 04 Nov 2017 14:36:19 +0000 https://www.exploringrpi.com/?page_id=451#comment-291 PHP5 does not install anymore, should update to php7.0 on commands listed on page 493.

]]>
By: Craig Clark https://www.exploringrpi.com/chapter12/#comment-277 Tue, 29 Aug 2017 00:05:55 +0000 https://www.exploringrpi.com/?page_id=451#comment-277 On page 510, the setting “hostname=myaccountname@gmail.com” in /etc/ssmtp/ssmtp.config caused the error “ssmtp: Cannot open smtp.gmail.com:587”. Changing it to “hostname=raspberrypi” which is the hostname of my raspberry pi corrected the problem.

]]>
By: Ubaid https://www.exploringrpi.com/chapter12/#comment-269 Fri, 11 Aug 2017 04:22:17 +0000 https://www.exploringrpi.com/?page_id=451#comment-269 Hello derek,

On your example for “IBM IoT MQTT C++” on page 520, the code exits with an rc state of 5.
I cannot figure out the issue with the same…


#include
#include
#include
#include
#include "MQTTClient.h"
#define CPU_TEMP "/sys/class/thermal/thermal_zone0/temp"
using namespace std;

#define ADDRESS "tcp://(MY_URL).messaging.internetofthings.ibmcloud.com:1883"
#define CLIENTID "d:(MY_URL):RaspberryPi:erpi01"
#define AUTHMETHOD "use-token-auth"
#define AUTHTOKEN "(MY_TOKEN)"
#define TOPIC "iot-2/evt/status/fmt/json"
#define QOS 1
#define TIMEOUT 10000L

float getCPUTemperature(){
int CPUTemp;
fstream fs;
fs.open(CPU_TEMP, fstream::in);
fs >> CPUTemp;
fs.close();
return (((float)CPUTemp)/1000);
}

int main(int argc, char* argv[]) {
MQTTClient client;
MQTTClient_connectOptions opts = MQTTClient_connectOptions_initializer;
MQTTClient_message pubmsg = MQTTClient_message_initializer;
MQTTClient_deliveryToken token;
MQTTClient_create(&client, ADDRESS, CLIENTID, MQTTCLIENT_PERSISTENCE_NONE, NULL);

opts.keepAliveInterval = 20;
opts.cleansession = 1;
opts.username = AUTHMETHOD;
opts.password = AUTHTOKEN;
int rc;
if ((rc = MQTTClient_connect(client, &opts)) != MQTTCLIENT_SUCCESS)
{
cout<<"Failed to connect "<<rc<<endl;
return -1;
}

stringstream message;

message <<"{\"d\":{\"Temp\":"<<getCPUTemperature()<<"}}";
pubmsg.payload = (char*) message.str().c_str();
pubmsg.payloadlen = message.str().length();
pubmsg.qos = QOS;
pubmsg.retained = 0;
MQTTClient_publishMessage(client, TOPIC, &pubmsg, &token);
cout<< "Waiting for " << (int) (TIMEOUT/1000) << "seconds for pub of"<<message.str()<<"\non topic"<<TOPIC<<"for ClientID:"<<CLIENTID<<endl;
rc = MQTTClient_waitForCompletion(client, token, TIMEOUT);
cout<<"Message with token"<< (int)token<<"delivered"<<endl;
MQTTClient_disconnect(client,10000);
MQTTClient_destroy(&client);
return rc;
}

Do we have to do anything else after creating a device on IBM bluemix..??
Frankly they have changed the entire interface of bluemix.

]]>
By: Steve Neave https://www.exploringrpi.com/chapter12/#comment-153 Sat, 21 Jan 2017 17:41:37 +0000 https://www.exploringrpi.com/?page_id=451#comment-153 Hi Derek,
Love your book. Love it to bits. But I got stuck on page 502 trying to install OpenSSL.

pi@raspberrypi:~ $ sudo apt install openssl libssl-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
openssl is already the newest version.
The following NEW packages will be installed:
libssl-dev libssl-doc
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2,262 kB of archives.
After this operation, 6,480 kB of additional disk space will be used.
Selecting previously unselected package libssl-dev:armhf.
dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package `libvorbisfile3:armhf’: Structure needs cleaning
E: Sub-process /usr/bin/dpkg returned an error code (2)

Steve
RPi3, default O/S, Linux newbie

]]>
By: admin https://www.exploringrpi.com/chapter12/#comment-61 Sun, 28 Aug 2016 23:01:33 +0000 https://www.exploringrpi.com/?page_id=451#comment-61 Thanks, it must have been updated and that is very useful to know. Kind regards, Derek.

]]>
By: R. Gutmann https://www.exploringrpi.com/chapter12/#comment-59 Sat, 27 Aug 2016 19:40:09 +0000 https://www.exploringrpi.com/?page_id=451#comment-59 In Listing 12.6 I believe the line
SocketClient sc( “thingpeak.com”,80);
should be
SocketClient sc(“api.thingspeak.com”, 80);

]]>