nodemcu and communicate with domoticz problem Topic is solved

Everything about esp8266 and more.

Moderator: leecollings

Post Reply
reza
Posts: 112
Joined: Tuesday 13 September 2016 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Contact:

nodemcu and communicate with domoticz problem

Post 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();
     }
  }
zak45
Posts: 953
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: nodemcu and communicate with domoticz problem

Post by zak45 »

Hi,
have begin to work with this device also.
ESPEasy ... so easy :
https://www.letscontrolit.com/wiki/index.php/ESPEasy
reza
Posts: 112
Joined: Tuesday 13 September 2016 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Contact:

Re: nodemcu and communicate with domoticz problem

Post 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.
reza
Posts: 112
Joined: Tuesday 13 September 2016 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Contact:

Re: nodemcu and communicate with domoticz problem

Post 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 ?
zak45
Posts: 953
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: nodemcu and communicate with domoticz problem

Post 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.
reza
Posts: 112
Joined: Tuesday 13 September 2016 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Contact:

Re: nodemcu and communicate with domoticz problem

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest