Page 1 of 1

Z-UNO Enatrance Gate Control

Posted: 05 Apr 2018 22:15
by Clie
Hi all,

I have not received an answer in the Russian part of this forum, I'll try here :)

The task is a drive the Roger technology entrance gates + control the status of septic tank.

Gate: Binary sensor (open state) + 2 relays for opening / closing
Septic: Binary sensor of fullness sensor

I wrote a sketch:

Code: Select all

// Entrance Gate + Septic state 
  
#define RelayOpen     9
#define RelayClose    10
#define OpenState     17
#define SepticState   18
#define ZUNO_CHANNEL_NUMBER_ONE 1
#define ZUNO_CHANNEL_NUMBER_TWO 2    

// Variables
  
byte LastOpenState;
byte LastSepticState;
byte openswitch = 1;
byte closeswitch = 1;

// Always connect

ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_ALWAYS_AWAKE);

//Channels setup

ZUNO_SETUP_CHANNELS(
  ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getgate),
  ZUNO_SENSOR_BINARY(ZUNO_SENSOR_BINARY_TYPE_GENERAL_PURPOSE, getseptic),
  ZUNO_SWITCH_BINARY(getopenswitch, setopenswitch),
  ZUNO_SWITCH_BINARY(getcloseswitch, setcloseswitch)
 );

void setup() 
  {
    pinMode(RelayOpen, OUTPUT);
    pinMode(RelayClose, OUTPUT);
    pinMode(OpenState, INPUT_PULLUP);
    pinMode(SepticState, INPUT_PULLUP);
  }

void 
   setopenswitch(byte value) 
   {digitalWrite(RelayOpen, (value > 0) ? LOW : HIGH); 
   openswitch = value;}
     
void 
  setcloseswitch(byte value) 
  {digitalWrite(RelayClose, (value > 0) ? LOW : HIGH);
  closeswitch = value;}
     
void loop() {
  
      byte CurrentOpenState = digitalRead(OpenState);
          if (CurrentOpenState != LastOpenState)           
              {LastOpenState = CurrentOpenState;                 
               zunoSendReport(ZUNO_CHANNEL_NUMBER_ONE);}  

       byte CurrentSepticState = digitalRead(SepticState);
          if (CurrentSepticState != LastSepticState)           
              {LastSepticState = CurrentSepticState;                 
               zunoSendReport(ZUNO_CHANNEL_NUMBER_TWO);}}
             
   
      byte getgate() 
            {if (LastOpenState == 0) 
                  {return 0xff;}
             else 
                  {return 0;}}

      byte getseptic() 
            {if (LastSepticState == 0) 
                  {return 0xff;}
             else 
                  {return 0;}}

       byte getopenswitch()
            {return openswitch;}

       byte getcloseswitch()
            {return closeswitch;}

Questions:

In the HC2 the relays and the gate opening sensor are detected only.
Capture2.JPG
Capture2.JPG (31.77 KiB) Viewed 2181 times
Where is the septic sensor?

Why the gate open sensor triggered when the opening relay is triggered?
Capture1.JPG
Capture1.JPG (31.88 KiB) Viewed 2181 times
So strange.

Re: Z-UNO Enatrance Gate Control

Posted: 08 Apr 2018 21:51
by PoltoS
Have you tried the special configuration parameter for HC2? It should solve the problem

Re: Z-UNO Enatrance Gate Control

Posted: 09 Apr 2018 14:15
by Clie
PoltoS wrote:
08 Apr 2018 21:51
Have you tried the special configuration parameter for HC2? It should solve the problem
Why no second binary sensor recognized?

Re: Z-UNO Enatrance Gate Control

Posted: 10 Apr 2018 02:46
by PoltoS
You need to exclude/include to let changes take place

Re: Z-UNO Enatrance Gate Control

Posted: 10 Apr 2018 10:42
by Clie
PoltoS wrote:
10 Apr 2018 02:46
You need to exclude/include to let changes take place
I'm understand that i need to exclude/include every time where code is changed.
I do not understand why HC does not find all the binary sensors.

Same trouble here:
https://forum.z-wave.me/viewtopic.php?f=3421&t=26355

Re: Z-UNO Enatrance Gate Control

Posted: 11 Apr 2018 00:36
by PoltoS
Then you change number of channels or basic behaviour (like battery vs mains) you have to exclude-include the device