Home central heating monitor/controller

4 years 9 months ago - 4 years 9 months ago #3676 by bmwmilos
Here is my code for ESP8266. I used EasyTransfer library to send/receive data to and from Arduino.For now I'm using 2004 LCD but will upgrade to 2.8" color lcd. I also need to add a rotary encoder with button so button will be used for local heating switch and encoder for modifying water temperature. Unfortunately I cannot get the ESP module 2 data to show up on cloud!!
Attachments:

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

4 years 9 months ago #3678 by EasyIoT

bmwmilos wrote: Here is my code for ESP8266. I used EasyTransfer library to send/receive data to and from Arduino.For now I'm using 2004 LCD but will upgrade to 2.8" color lcd. I also need to add a rotary encoder with button so button will be used for local heating switch and encoder for modifying water temperature. Unfortunately I cannot get the ESP module 2 data to show up on cloud!!


EasyTransfer and additional Arduino is also good idea. I'm thinking to use touch screen. Then is no need for rotary encoder with button.

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

4 years 9 months ago #3679 by EasyIoT

bmwmilos wrote: I will also put ili9341 screen, I am just waiting to arrive. The arduino part is already in place and functioning. I will only add esp8266 part with additional display.
Will post the code this evening when I come home.
As for the publishing, I cannot seem to get it to work. I am using the code
String valueStr(TempPolaz) and add different topic with different module ID and sensor name but there are no values in cloud! I have even tried to eliminate that part of the code and publish a fixed value over longer period ( once every 60 seconds ) but no luck! I cannot understand where is the problem. The module ID is correct. Before this I had a problem with control module but the values were getting sent. Now when I separated into two modules,the one with generic type only shows sensor names and ":" and absolutely no values. This evening I wil try to eliminate "subscribe" to first module and see if I can upload data then!
I think you can make a module of type generic + dimmer, just the first two parameters would be for dimmer ( control ) and then the generic part would be :
with added & module.Parameters > 2 and modified for (var p = 2;

if (module.Parameters != null & module.Parameters > 2) {
	for (var p = 2; p < module.Parameters.length; p++) {
		if (module.Parameters[p].Name.substring(0, 7) == "Sensor.") {
			data.status = data.status + ((module.Parameters[p].Description == "") ? module.Parameters[p].Name : module.Parameters[p].Description) + ": " + module.Parameters[p].Value + ((module.Parameters[p].Unit == "") ? "" : "&nbsp;" + module.Parameters[p].Unit) + "<br>";
			if (data.timestamp < module.Parameters[p].Timestamp)
				data.timestamp = module.Parameters[p].Timestamp;
		}
	  }
}
This way one could add as many other monitoring sensors as necessary.
I am still new to html and java but I'm trying.


I guess module.Parameters > 2 is not correct. Try module.Parameters.length > 2.

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

4 years 9 months ago #3682 by EasyIoT

EasyIoT wrote:

bmwmilos wrote: I will also put ili9341 screen, I am just waiting to arrive. The arduino part is already in place and functioning. I will only add esp8266 part with additional display.
Will post the code this evening when I come home.
As for the publishing, I cannot seem to get it to work. I am using the code
String valueStr(TempPolaz) and add different topic with different module ID and sensor name but there are no values in cloud! I have even tried to eliminate that part of the code and publish a fixed value over longer period ( once every 60 seconds ) but no luck! I cannot understand where is the problem. The module ID is correct. Before this I had a problem with control module but the values were getting sent. Now when I separated into two modules,the one with generic type only shows sensor names and ":" and absolutely no values. This evening I wil try to eliminate "subscribe" to first module and see if I can upload data then!
I think you can make a module of type generic + dimmer, just the first two parameters would be for dimmer ( control ) and then the generic part would be :
with added & module.Parameters > 2 and modified for (var p = 2;

if (module.Parameters != null & module.Parameters > 2) {
	for (var p = 2; p < module.Parameters.length; p++) {
		if (module.Parameters[p].Name.substring(0, 7) == "Sensor.") {
			data.status = data.status + ((module.Parameters[p].Description == "") ? module.Parameters[p].Name : module.Parameters[p].Description) + ": " + module.Parameters[p].Value + ((module.Parameters[p].Unit == "") ? "" : "&nbsp;" + module.Parameters[p].Unit) + "<br>";
			if (data.timestamp < module.Parameters[p].Timestamp)
				data.timestamp = module.Parameters[p].Timestamp;
		}
	  }
}
This way one could add as many other monitoring sensors as necessary.
I am still new to html and java but I'm trying.


I guess module.Parameters > 2 is not correct. Try module.Parameters.length > 2.


I was too quick reading your email. Your suggestion for modules is good and it will be implemented.
To solve your problem first check if you exceeded monthly write limit under Config->Account Limit. "Writes in period" should be less than "Write limit". Next I recommend you to use MQTT simulator (for example MQTT spy) to check if problem lies in EasyIoT CLoud or ESP8266.

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

4 years 9 months ago - 4 years 9 months ago #3683 by bmwmilos
I did some further testing and discovered that it is not possible to do what I need with 2 separate modules! If I only do publish without subscribe I can write values to 2 separate modules! However if in my code I subscribe to one module, I cannot publish anymore to both modules. I do not know why is this. For testing I used a relay code in which I added a fixed parameter that I was trying to publish to another generic module.Relay code worked ok,but when I added second module,after subscribing to first module the cloud does not receive data anymore! If I switch on the led by cloud,or with button the led switches on and publishes value 1, but the server publishes back value 0 and the led switches off. However if I eliminate the subscribe in my code the values are published correctly! The initial setup works ok,the modules get created as I publish in my code.
I guess if you are subscribed to one module you cannot publish to another module with same client string.
The best thing would be create a new module as I described above, Led dimmer ( AO,DO ) and with additional sensor status list!
Oh, and I only have about 2000 writes in the last period so no problem there.

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

4 years 9 months ago #3684 by bmwmilos
Today I have lost a lot of time but was unable to do anything! There is some serious problem with server. After a lot of tries,I took another esp8266 module and loaded Relay_switch_mqqt v1. The DO module is created and when I try from the app the led switches on and off correctly. However if I log into my web cloud, nothing is working!! When I switch ON the led through web the led lights up for a second or two and then it shuts down. I get the following on serial monitor:
Received topic:/4/Sensor.Parameter1: 1
switch state received: 1
Publish /4/Sensor.Parameter1 1
published.
Received topic:/4/Sensor.Parameter1: 0
switch state received: 0
Publish /4/Sensor.Parameter1 0
published.
So it seems that the server sends 1, esp replies with 1 to confirm,but server interprets 1 as 0 and resends 0.
Can you please verify this, I think the problem lies within cloud server. If the led is switched on from the app and then I login into my cloud,the led switches off . So even the value 1 from the app does not get published!

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

Time to create page: 0.266 seconds