Module (DO) not working on Pi

8 years 4 months ago #2661 by Adam69
Dear all,
At the moement I am running the EasyIoT server on a Raspberry Pi, where an module 'Temperature' is working fine from an ESP8266. Next test for me was the Digital Output to connect with a relais. ESP8266 is working fine, testing this from a browser web interface, led going on/off on GPIO2.
Module not working from EasyIoT server. The server seems to do all just not start the Automation Program.

As test, download and started the EasyIoT server on windows 7 machine (easyiot_win_v0_9). Deleted all of the demo config and created an copy of the my Pi config (from the main web interface, not file copy).
On the windows machine the relais seems to work fine, led on GPIO2 does go on/off, and I can see some output in the terminal indicating some actons being done, all good.

For some day's, I have been looking to find the magic where it all goes wrong on the Raspberry Pi, but am not able to find it.
To me, it seems that it has something to do with the start of the a program, not being called correctly from the event when you click the on/off status on the (DO) module.
Has anyone seen and corrected this? And would you be so kind to help me out?
Any tips on where to go for debug?
Warm and kind regards,
Adam

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

8 years 4 months ago #2662 by Adam69
EXTRA information.

To test the actions on the EasyIOT server running on the Pi, I have add an Cron job to set the relais on... example found here on this forum:
public void Run()
{
DriverHelper.ProcessCommad(Domains.VIRTUAL, "N1S0", "ControlOn","");
}

The console, does report some actions and I can see at the webinterface that the Module has been set to ON. This means that the Cron job did start, but again not the program to send URL to the ESP8266.

At the console, found this ERROR, where I do not know for sure this is the problem....
[ at System.Net.Sockets.TcpClient.Connect (System.Net.IPAddress[] ipAddresses, Int32 port) [0x00000] in <filename unknown>:0]

The program that I use for the relais module comes from the Windows example, also I have found the same code on the web, so looks fine to me, this code:

const String ESP8266_IP_ADDRESS = "192.168.1.10";

/*
This code is running one time when program is enabled
*/
public void Setup()
{

// System.Diagnostics.Process.Start("CMD.exe","");

EventHelper.ModuleChangedHandler((o, m, p) =>
{
Console.WriteLine(m.Domain +" "+ m.Address + " in program id "+ Program.ProgramId.ToString()+ " property "+ p.Property + " value " + p.Value);

if (m.Domain == "Virtual" && m.Address == "N1S0" && p.Property == "Sensor.DigitalValue")
sendCommand(p.Value);

return true;
});

}

/*
This code is running periodicaly when program is enabled.
Cron job detirmine running period.
*/
public void Run()
{
}



private void sendCommand(string value)
{
sendToServer("/gpio/"+value);
}



private void sendToServer(String message)
{
try
{
Console.WriteLine("TCP client command:" + message);

Int32 port = 80;
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient( ESP8266_IP_ADDRESS, port);
Byte[] data = System.Text.Encoding.ASCII.GetBytes(message);
System.Net.Sockets.NetworkStream stream = client.GetStream();
stream.Write(data, 0, data.Length);
// Close everything.
stream.Close();
client.Close();
}
catch(Exception e)
{
Console.WriteLine(e.StackTrace);
}
}

Again any help would be nice, and hope this part of information does help.
Adam

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

8 years 4 months ago #2669 by Adam69
Dear all,

Found the problem. Not the hardware and not the software. Actually all is and was working perfect !!!
The fault was some firewall not working correct. Or being honnest made the mistake of not checking this, but assumed it would work fine.
Really happy with the project.
Thank you for your intrest and reading this.
Kind regards.

Adam

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

Time to create page: 0.217 seconds

Forum latest

  • No posts to display.