MQTT and Thingspeak at the same time

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
petrho
Normal user
Posts: 20
Joined: 14 Apr 2016, 17:17

MQTT and Thingspeak at the same time

#1 Post by petrho » 23 Jul 2016, 14:00

I would like to have both MQTT and Thingspeak support at the same time. Is it possible to make it via the rule engine?

//Peter

sonnyboy
New user
Posts: 5
Joined: 08 Aug 2016, 13:38

Re: MQTT and Thingspeak at the same time

#2 Post by sonnyboy » 19 Aug 2016, 14:01

Like the idea :)

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: MQTT and Thingspeak at the same time

#3 Post by nonflammable » 19 Aug 2016, 18:41

i think it is possible temporarily with two esp8266 configured separately (first with MQTT, second with Thingspeak) and enabled synchronization between them :)
or use SendToHTTP in rules eg.
SendToHTTP 184.106.153.149,80,/update.html?key=YOURKEY&field1=[your#value]

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: MQTT and Thingspeak at the same time

#4 Post by Drum » 22 Aug 2016, 12:25

I don't see why you can not use Rules to send MQTT and the Thingspeak template. I used Domoticz HTTP template and MQTT via rules. I found it was not that reliable in an older version, R104 or R107 I think. The rules would sometimes send the first of the BME280 values and the other 2 would be "null". It worked perfect for a while then it stopped, no idea why. The new versions may work better, there is a newer version of PUBSUB.

My fix was to just switch to openHab MQTT and stopped using rules for sending MQTT. I don't use Thinkgspeak so I can't help there.

sonnyboy
New user
Posts: 5
Joined: 08 Aug 2016, 13:38

Re: MQTT and Thingspeak at the same time

#5 Post by sonnyboy » 22 Aug 2016, 21:02

nonflammable wrote: or use SendToHTTP in rules eg.
SendToHTTP 184.106.153.149,80,/update.html?key=YOURKEY&field1=[your#value]
I cant get this to work
SendToHTTP 184.106.153.149,80,/update.html?key=mykey&field1=[garaget#Humidity]
Nothing gets updated on Thingspeak, any suggestion?
i got this in the log
128939493 : EVENT: garaget#Humidity=68.00

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: MQTT and Thingspeak at the same time

#6 Post by nonflammable » 23 Aug 2016, 11:31

sonnyboy wrote: I cant get this to work
SendToHTTP 184.106.153.149,80,/update.html?key=mykey&field1=[garaget#Humidity]
Nothing gets updated on Thingspeak, any suggestion?
i got this in the log
128939493 : EVENT: garaget#Humidity=68.00
http://www.esp8266.nu/index.php/Tutorial_Rules

Code: Select all

On garaget#Humidity do
SendToHTTP 184.106.153.149,80,/update.html?key=mykey&field1=[garaget#Humidity]
endon

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: MQTT and Thingspeak at the same time

#7 Post by nonflammable » 27 Aug 2016, 09:07

Solved ?

sonnyboy
New user
Posts: 5
Joined: 08 Aug 2016, 13:38

Re: MQTT and Thingspeak at the same time

#8 Post by sonnyboy » 27 Aug 2016, 09:22

nonflammable wrote:Solved ?
I cant get this to work. My friend petrho will test this this weekend.
Got no error in the log, but thingspeak doesent update.

petrho
Normal user
Posts: 20
Joined: 14 Apr 2016, 17:17

Re: MQTT and Thingspeak at the same time

#9 Post by petrho » 29 Aug 2016, 20:32

works fine here...

petrho
Normal user
Posts: 20
Joined: 14 Apr 2016, 17:17

Re: MQTT and Thingspeak at the same time

#10 Post by petrho » 29 Aug 2016, 21:12

But why cant I send multiple commands?

On System#Uptime do
SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field1=[Temp_Hum#Temperature]
SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field2=[Temp_Hum#Humidity]
SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field3=[System#Uptime]
endon

only sent the first line...

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: MQTT and Thingspeak at the same time

#11 Post by nonflammable » 30 Aug 2016, 00:09

petrho wrote:But why cant I send multiple commands?

only sent the first line...
try to add empty line after "endon" and space before SendToHTTP :)

Code: Select all

On Clock#Time do
 SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field1=[Temp_Hum#Temperature]
 SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field2=[Temp_Hum#Humidity]
 SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field3=[System#Uptime]
endon


petrho
Normal user
Posts: 20
Joined: 14 Apr 2016, 17:17

Re: MQTT and Thingspeak at the same time

#12 Post by petrho » 30 Aug 2016, 00:29

nonflammable wrote:
petrho wrote:But why cant I send multiple commands?

only sent the first line...
try to add empty line after "endon" and space before SendToHTTP :)

Code: Select all

On Clock#Time do
 SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field1=[Temp_Hum#Temperature]
 SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field2=[Temp_Hum#Humidity]
 SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field3=[System#Uptime]
endon

Unfortunately same problem...

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: MQTT and Thingspeak at the same time

#13 Post by nonflammable » 30 Aug 2016, 12:57

petrho wrote: Unfortunately same problem...
this should be ok :) (Currently, a single channel can only be updated once every 15 seconds.)

Code: Select all

On Clock#Time do
 SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field1=[Temp_Hum#Temperature]&field2=[Temp_Hum#Humidity]&field3=[System#Uptime]
endon


petrho
Normal user
Posts: 20
Joined: 14 Apr 2016, 17:17

Re: MQTT and Thingspeak at the same time

#14 Post by petrho » 30 Aug 2016, 14:39

nonflammable wrote:
petrho wrote: Unfortunately same problem...
this should be ok :) (Currently, a single channel can only be updated once every 15 seconds.)

Code: Select all

On Clock#Time do
 SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field1=[Temp_Hum#Temperature]&field2=[Temp_Hum#Humidity]&field3=[System#Uptime]
endon

aha - you are right. Is it any delay command possible in the rule engine?

User avatar
nonflammable
Normal user
Posts: 42
Joined: 09 Mar 2016, 22:19
Location: Poland

Re: MQTT and Thingspeak at the same time

#15 Post by nonflammable » 30 Aug 2016, 23:01

petrho wrote: aha - you are right. Is it any delay command possible in the rule engine?
Yes :)

Code: Select all

Delay <milliseconds>
eg.

Code: Select all

On Clock#Time do
 SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field1=[Temp_Hum#Temperature]&field2=[Temp_Hum#Humidity]&field3=[System#Uptime]
 Delay 15000
 SendToHTTP 184.106.153.149,80,/update.html?key=xxx&field1=[Temp_Hum#Temperature]&field2=[Temp_Hum#Humidity]&field3=[System#Uptime]
endon
There are all commands:
http://www.esp8266.nu/index.php/ESPEasy ... _Reference

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest