Page 1 of 1

nodemcu and communicate with domoticz problem

Posted: Thursday 08 June 2017 20:20
by reza
hi friends
i see this page (https://www.domoticz.com/wiki/ESP8266_WiFi_module) and i want use IDE for nodemcu for communicate.
i use this code for communicate test but dont work.
Do I need to do on raspberry and domoticz?

Code: Select all

#include <Wire.h>
#include <ESP8266WiFi.h>

#define MY_ESP8266_SSID "*****"
#define MY_ESP8266_PASSWORD "*****"


// int status = WL_IDLE_STATUS;     // the Wifi radio's status
WiFiClient client;

// domoticz
 const char * domoticz_server = "192.168.1.200"; //Domoticz port
 int port = 8080; //Domoticz port
 int idx = 61; //IDX for this virtual sensor, found in Setup -> Devices

 float A = 70;
 float B = 80;
  

 void setup()
 {

 }

 void loop()
 {
    printInfo();
    delay(60000); // Wait 60 seconds
 }

   
 void printInfo()
 {
    // Domoticz format /json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=TEMP;HUM;HUM_STAT

    if (client.connect(domoticz_server,port)) {

        client.print("GET /json.htm?type=command&param=udevice&idx=");
        client.print(idx);
        client.print("&nvalue=0&svalue=");
        client.print(A);
        client.print(";");
        client.print(B);
        client.print(";0"); //Value for HUM_STAT. Can be one of: 0=Normal, 1=Comfortable, 2=Dry, 3=Wet
        client.println(" HTTP/1.1");
        client.print("Host: ");
        client.print(domoticz_server);
        client.print(":");
        client.println(port);
        client.println("User-Agent: Arduino-ethernet");
        client.println("Connection: close");
        client.println();
        
        client.stop();
     }
  }

Re: nodemcu and communicate with domoticz problem

Posted: Thursday 08 June 2017 20:25
by zak45
Hi,
have begin to work with this device also.
ESPEasy ... so easy :
https://www.letscontrolit.com/wiki/index.php/ESPEasy

Re: nodemcu and communicate with domoticz problem

Posted: Thursday 08 June 2017 20:38
by reza
zak45 wrote:Hi,
have begin to work with this device also.
ESPEasy ... so easy :
https://www.letscontrolit.com/wiki/index.php/ESPEasy
thank you dear zak, i will see and read this.

Re: nodemcu and communicate with domoticz problem

Posted: Friday 09 June 2017 18:19
by reza
zak45 wrote:Hi,
have begin to work with this device also.
ESPEasy ... so easy :
https://www.letscontrolit.com/wiki/index.php/ESPEasy
hi zak. i see espeasy and this is intersting,but 2 question .thank you.
espeasy just used for sensors and just for send message to controller? if i want connect nodemcu to a relay module and control this with domoticz so i can not ??
also in this link in the end of page https://www.domoticz.com/wiki/ESP8266_WiFi_module i think we can use arduino and nodemcu without espeasy.is this true ?

Re: nodemcu and communicate with domoticz problem

Posted: Sunday 11 June 2017 17:44
by zak45
Control relay: yes
https://www.letscontrolit.com/wiki/index.php/Relays
https://www.letscontrolit.com/wiki/index.php/Relais
ESPeasy if only another firmware .. but very easy to use and directly linked with Domoticz.. really nice.
if you want nodemcu .. no problem, just more programming is needed.

Re: nodemcu and communicate with domoticz problem

Posted: Sunday 11 June 2017 18:03
by reza
zak45 wrote:Control relay: yes
https://www.letscontrolit.com/wiki/index.php/Relays
https://www.letscontrolit.com/wiki/index.php/Relais
ESPeasy if only another firmware .. but very easy to use and directly linked with Domoticz.. really nice.
if you want nodemcu .. no problem, just more programming is needed.
thank you dear friend