MQTT update drivers?

8 years 7 months ago - 8 years 7 months ago #3201 by piman
MQTT update drivers? was created by piman
@EasyIoT
:( is there any chance of an update driver for mqtt easyiot sever that works properly and bug free, I understand you are very busy and you are punting the cloud but I started with the Raspberry pi which is what I'd would like to keep to. Please! :(
Thank you Andy.

Please Log in or Create an account to join the conversation.

8 years 7 months ago #3205 by ppecuch
Replied by ppecuch on topic MQTT update drivers?
Hi,
I test too the driver and works. I have UNO+W5100 ---- Raspberry+Mosquitto. I tested ds18b20, dht11 and relay. Here is example ds18b20:

#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h> //set 3.1
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 7

byte mac[] = { 0x00, 0x02, 0xB3, 0x9F, 0xA3, 0xFD };
IPAddress ip(10,0,0,183);
IPAddress server(10,0,0,146);
float temp0 = 0;
char temp0String[6];
long lastjob = 0;

EthernetClient ethClient;
PubSubClient client(ethClient);

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup()
{
Serial.begin(115200);
client.setServer(server, 1883);
client.setCallback(callback);
Ethernet.begin(mac, ip);
delay(1500);
sensors.begin();
}

void callback(char* topic, byte* payload, unsigned int length)
{
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
for (int i=0;i<length;i++) {
Serial.print((char)payload);
}
Serial.println();
}

void reconnect() {
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
if (client.connect("arduinoClient")) {
Serial.print("connected ");

} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
delay(5000);
}
}
}

void loop()
{
if (!client.connected()) {
reconnect();
}
client.loop();
if (millis() > (30000 + lastjob))
{
sensors.requestTemperatures();
temp0 = (sensors.getTempCByIndex(0));
dtostrf(temp0, 2, 2, temp0String);
client.publish("outTopic",temp0String);
Serial.print("Teplota D0: ");
Serial.println(temp0);
lastjob = millis();
}
}

Please Log in or Create an account to join the conversation.

8 years 7 months ago #3213 by piman
Replied by piman on topic MQTT update drivers?
Your answer to my question, is totally irrelevant I didn't say it does not work,

Please Log in or Create an account to join the conversation.

8 years 7 months ago #3219 by EasyIoT
Replied by EasyIoT on topic MQTT update drivers?

piman wrote: @EasyIoT
:( is there any chance of an update driver for mqtt easyiot sever that works properly and bug free, I understand you are very busy and you are punting the cloud but I started with the Raspberry pi which is what I'd would like to keep to. Please! :(
Thank you Andy.


@piman right now I'm very busy doing other things, even Cloud is not priority. But when I will have time I will fix problem with MQTT on server...just be patient please...
The following user(s) said Thank You: piman

Please Log in or Create an account to join the conversation.

Time to create page: 0.206 seconds

Forum latest

  • No posts to display.