code

9 years 1 week ago - 9 years 1 week ago #1093 by piman
code was created by piman
hi
I fought i would tried some automation this weekend but I seem to have a problem with some of the examples from the forum which do not compile, manage to get one program to compile but no automation outport maybe I'm missing something within my code here is an example ,a little help will be appreciated thank you, :blush:
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 == "1")
	  DriverHelper.ProcessCommad(Domains.RPIGPIO, "Pin_P1_07", "ControlOn", "1");

        return true;
    });
      
      
    } 
}
Maybe I should explain what I am trying to do, which is a simple door sensor open and closed to a buzzer on the Rasberry pie so when the door opens the buzzer will go on and door closes the buzzer will go off/stop.


Thanks Andy.

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

9 years 1 week ago #1094 by HarryDutch
Replied by HarryDutch on topic code
You have to use this:
if (m.Domain == Domains.MYSENSORS && m.Address == "N11S3" && p.Property == "Sensor.Door/Window" && p.Value == "1")

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

9 years 1 week ago #1095 by piman
Replied by piman on topic code
Thanks Harry,
I tried your code alteration which compiled fine but I still have no automation output I think the problem may lie with the help driver on the pi side of things, could do with some updated sample code as I think a lot of the examples are full older versions, not sure maybe somebody can correct me on this and give a little help thanks.
Andy.

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

9 years 1 week ago #1096 by HarryDutch
Replied by HarryDutch on topic code
In the last part of your automation code (DriverHelper) you have to remove the last 1 between quotes. So like this
, "");

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

9 years 1 week ago #1097 by piman
Replied by piman on topic code
Still no joy!! :(
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.Door/Window" && p.Value == "1")
      
	 
 	DriverHelper.ProcessCommad(Domains.RPIGPIO, "Pin_P1_07", "ControlOn","");
      

        return true;
    });
      
      
    } 
}

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

9 years 1 week ago #1099 by HarryDutch
Replied by HarryDutch on topic code
Change Sensor.Door/Window in Sensor.DoorWindow. My mistake. Sorry.
The following user(s) said Thank You: piman

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

Time to create page: 0.183 seconds

Forum latest

  • No posts to display.