Cannot connect esp12 gateway to openhab

47 views
Skip to first unread message

Tejo W. Effendi

unread,
Apr 27, 2017, 11:40:14 AM4/27/17
to souliss
Hello, I have a problem to connect souliss with openhab2. I have an esp12-e as a souliss gateway with latest library, but unable to send command from OH. Android app is working normally.

I see from wireshark that OH server and souliss gateway are communicating every second, but no command is received. Health and timestamp is blank too.

Here I attach all files that I believe significant to this binding. Also I attach screenshot of wireshark sniffing communication from openhab server with souliss gateway at 192.168.1.90

Thank you for your help.


souliss.ino (this gateway have static IP binding on 192.168.1.90)

/**************************************************************************
    Souliss - Hello World for Expressif ESP8266
   
   This is the basic example, create a software push-button on Android
   using SoulissApp (get it from Play Store).  
   
   Load this code on ESP8266 board using the porting of the Arduino core
   for this platform.
       
***************************************************************************/

// Let the IDE point to the Souliss framework
#include "SoulissFramework.h"

// Configure the framework
#include "bconf/MCU_ESP8266.h"              // Load the code directly on the ESP8266
#include "conf/Gateway.h"                   // The main node is the Gateway, we have just one node
#include "conf/IPBroadcast.h"

// **** Define the WiFi name and password ****
#define WIFICONF_INSKETCH
#define WiFi_SSID               "wifi"
#define WiFi_Password           "password"    

// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include <OneWire.h>
#include <DallasTemperature.h>


/*** All configuration includes should be above this line ***/
#include "Souliss.h"

// for debugging
//#define SERIALPORT_INSKETCH
//#define LOG    Serial

// This identify the number of the LED logic
#define MYLEDLOGIC1          0              
#define MYLEDLOGIC2          1              
#define MYLEDLOGIC3          2  
#define MYLEDLOGIC4          3              

// **** Define here the right pin for your ESP module ****
#define      OUTPUTPIN1                      D1
#define  OUTPUTPIN2     D2
#define  OUTPUTPIN3     D3
#define  OUTPUTPIN4     D4

#define PRESSURE0             10               // Leave 2 slots for T58
//#define TEMP0                 12               // Leave 2 slots for T52

#define Dallas_1                 4           // This is the memory slot used for the execution of the logic in network_address1

#define DEADBAND            0.01        // Deadband value 1%

#define One_Wire_Bus_Pin  D5


OneWire oneWire(One_Wire_Bus_Pin);
DallasTemperature sensors(&oneWire);
DeviceAddress Temperatura_exterioara =
{0x28, 0x8C, 0x39, 0x26, 0x00, 0x00, 0x80, 0x0B};


void setup()
{  
    Initialize();
   sensors.begin();
   Serial.begin(9600);
   // Connect to the WiFi network and get an address from DHCP
   GetIPAddress();                          
    SetAsGateway(myvNet_dhcp);       // Set this node as gateway for SoulissApp  

    // This is the vNet address for this node, used to communicate with other
  // nodes in your Souliss network
   SetAddress(0xAB01, 0xFF00, 0x0000);
   //SetAsPeerNode(0xAB02, 1);
   //SetAsPeerNode(0xAB03, 2);
   //SetAsPeerNode(0xAB04, 3);

   
   
    Set_SimpleLight(MYLEDLOGIC1);        // Define a simple LED light logic
   Set_SimpleLight(MYLEDLOGIC2);        // Define a simple LED light logic
   Set_SimpleLight(MYLEDLOGIC3);        // Define a simple LED light logic
   Set_SimpleLight(MYLEDLOGIC4);        // Define a simple LED light logic
   
   pinMode(OUTPUTPIN1, OUTPUT);         // Use pin as output
    pinMode(OUTPUTPIN2, OUTPUT);         // Use pin as output
    pinMode(OUTPUTPIN3, OUTPUT);         // Use pin as output
   pinMode(OUTPUTPIN4, OUTPUT);         // Use pin as output

    Set_Pressure(PRESSURE0);
     // Set the typical to use:
 Set_Temperature(Dallas_1);
 sensors.setResolution(Temperatura_exterioara, 10);

}

void loop()
{
    // Here we start to play

   
   
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds
           Logic_SimpleLight(MYLEDLOGIC1);
           LowDigOut(OUTPUTPIN1, Souliss_T1n_Coil,MYLEDLOGIC1);

            Logic_SimpleLight(MYLEDLOGIC2);
           LowDigOut(OUTPUTPIN2, Souliss_T1n_Coil,MYLEDLOGIC2);

            Logic_SimpleLight(MYLEDLOGIC3);
           LowDigOut(OUTPUTPIN3, Souliss_T1n_Coil,MYLEDLOGIC3);

            Logic_SimpleLight(MYLEDLOGIC4);
           LowDigOut(OUTPUTPIN4, Souliss_T1n_Coil,MYLEDLOGIC4);

        }
              FAST_910ms()
   {
     // Aquire temperature from the ADC.
     sensors.requestTemperatures();
     float dallas = sensors.getTempC(Temperatura_exterioara);
     Serial.println(dallas);
     Souliss_ImportAnalog(memory_map, Dallas_1, &dallas);
   }
   FAST_2110ms()
   {
     Logic_Temperature(Dallas_1);
   }
       // Here we handle here the communication with Android
       FAST_GatewayComms();                
    }
   EXECUTESLOW()
   {  
        UPDATESLOW();
       SLOW_10s()  {

            Logic_Pressure(PRESSURE0);
           
                   
        }
       
       SLOW_50s()  {
         float pressure = 1000;
         
         ImportAnalog(PRESSURE0, &pressure);
         
       }  
    }
   
     

}


Souliss.cfg (souliss gateway get IP 192.168.1.90)

# For ITEM defination in file .item
#{souliss=<Typical>:<nodeID>:<slot>:[<bit>]}

IP_LAN=192.168.1.90
USER_INDEX=79
NODE_INDEX=79
#SERVERPORT - Leave empty for casual port
SERVERPORT=

# time in mills
REFRESH_DBSTRUCT_TIME=600000
REFRESH_SUBSCRIPTION_TIME=120000
REFRESH_HEALTY_TIME=60000
REFRESH_MONITOR_TIME=500
SEND_DELAY=1500
SEND_MIN_DELAY=100
SECURE_SEND_TIMEOUT_TO_REQUEUE=5000
SECURE_SEND_TIMEOUT_TO_REMOVE_PACKET=30000

Souliss.items

Group All
Group grp1              (All)
Group Diagnostic        (All)
Group TechnicView_Node0 (All)

Switch SimpleLight1  "SimpleLight5" (grp1, TechnicView_Node0) {souliss="T11:0:0", autoupdate=“true”}

Switch SimpleLight2  "SimpleLight6" (grp1, TechnicView_Node0) {souliss="T11:0:1", autoupdate=“true”}

Switch SimpleLight3  "SimpleLight7" (grp1, TechnicView_Node0) {souliss="T11:0:2", autoupdate=“true”}

Switch SimpleLight4  "SimpleLight8" (grp1, TechnicView_Node0) {souliss="T11:0:3", autoupdate=“true”}

Number HEALTHNodo0 "Health Node 0 [%1d]” <keyring> (Diagnostic, TechnicView_Node0, Health) {souliss="D98:0:998"}

String TIMESTAMP_Nodo0 "Update Node 0 [%1$td.%1$tm.%1$tY %1$tk:%1$tM:%1$tS]" <keyring> (Diagnostic, TechnicView_Node0) {souliss="D99:0:999"}


souliss.sitemap
sitemap souliss1 label="Main Menu"
{
Frame label="Souliss - Hello World" {
               Switch item=SimpleLight1 mappings=[ON="ON", OFF="OFF"]
         Switch item=SimpleLight2 mappings=[ON="ON", OFF="OFF"]
         Switch item=SimpleLight3 mappings=[ON="ON", OFF="OFF"]
         Switch item=SimpleLight4 mappings=[ON="ON", OFF="OFF"]
         Text item=HEALTHNodo0 icon="icon16x16"
         Text item=TIMESTAMP_Nodo0 icon="icon16x16"
     }
}




Holger Lösken

unread,
Apr 27, 2017, 11:51:43 AM4/27/17
to souliss
Hi,

I think I have nearly the same setup, but in the item definition I use autoupdate="false".
Maybe you try that.
Is your IP adress correct in the souliss.cfg?

Holger

Tejo W. Effendi

unread,
Apr 27, 2017, 12:24:32 PM4/27/17
to souliss
It worked! I believe that I change it because false option as default didn't work before, but it is now working, so no more problem. Thanks Holger!

But health node and timestamp is not updated yet.
Reply all
Reply to author
Forward
0 new messages