- Posts: 46
- Karma: 1
- Thank you received: 7
const String ESP8266_IP_ADDRESS = "192.168.1.110";
/*
This code is running one time when program is enabled
*/
public void Setup()
{
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 == "N6S0" && p.Property == "Sensor.DimmerLevel")
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("LED1_target="+value); \\ LED1 - here we set channel
}
private void sendToServer(String message)
{
try
{
Console.WriteLine("TCP client command:" + message);
Int32 port = 43333;
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);
}
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please help with this, trying to get it working, always no result.Just call in ESP8266 lua:
http://[IP address]Api/EasyIoT/Control/Module/Virtual/[address]ControlLevel/[value]
IP adress - EasyIoT server address
address - virtual module address
value - temperature value
and value will be recorded to EasyIoT server. This is suitable for simple sensor nodes.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
1) Flash modified firmware.Dennis wrote: Wow, this looks mighty interesting, esp8266 relay nodes without arduino! But how does the node get its Wifi setup params? Do I have to initially set it up via serial terminal, and then it remembers this settings?
regards
Please Log in or Create an account to join the conversation.
VasilijHCN wrote:
Please help with this, trying to get it working, always no result.Just call in ESP8266 lua:
http://[IP address]Api/EasyIoT/Control/Module/Virtual/[address]ControlLevel/[value]
IP adress - EasyIoT server address
address - virtual module address
value - temperature value
and value will be recorded to EasyIoT server. This is suitable for simple sensor nodes.
Please Log in or Create an account to join the conversation.