Remote switch turns on remote relay

8 years 2 months ago - 8 years 2 months ago #3466 by bleo8onhs
Hi! I started using easyiot a while ago and i setup a raspberrypi2 easyiot server, three nodes, all with esp8266 and arduino nano. One checks the temp(N2S0) and humidity(N2S1)(dht22), other has two relays(N3S1) and the other is a switch(N4S0). Everything are driven from the esp8266 driver. I want to use them for an home automation project. I am trying to create an automation so that when i press the switch the remote relay activates.

Can you help me with the code?

EDIT: The relay is set as an digital output and the switch as an digital input

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

8 years 2 months ago #3469 by piman

piman wrote: :woohoo: Thanks Harry,
That seemed to have done the trick thanks a lot, I have modified the code slightly so that it switches the buzzer off when the door is closed, here is an example just in case someone else was having the same problem I was. I think I've got it now thanks to Harry.

public void Setup()

{

    {

EventHelper.ModuleChangedHandler((o, m, p) =>
    {
    	Console.WriteLine(m.Address + " in program id "+ Program.ProgramId.ToString()+ " property "+ p.Property + " value " + p.Value);
	
      
    if (m.Domain == Domains.MYSENSORS && m.Address == "N11S3" && p.Property == "Sensor.DoorWindow" && p.Value == "1")
      
	 
 	DriverHelper.ProcessCommad(Domains.RPIGPIO, "Pin_P1_07", "ControlOn","");
      
     
   if (m.Domain == Domains.MYSENSORS && m.Address == "N11S3" && p.Property == "Sensor.DoorWindow" && p.Value == "0")

	DriverHelper.ProcessCommad(Domains.RPIGPIO, "Pin_P1_07", "ControlOff","");
      
        return true;
    });
      
    } 
}
Next step email notification.

Try this should help

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

Time to create page: 0.905 seconds

Forum latest

  • No posts to display.