[Release] HubDuino v1.1.9 - Hubitat to Arduino / ESP8266 / ESP32 / ThingShield Integration (ST_Anything)

I'm using the Aritech/Interlogix EV1012 PIR sensor. I cannot find anything in the manual about being able to change the output signal.

I am guessing that sensor is typically used with a wired home security system, correct?

I am sure we could improve the ST_Anything IS_Motion device class to add some sort of optional parameter that would allow the delay of sending the 'inactive' status update for a specified timeout period. If motion becomes active again during that time, simply cancel the timer and wait for the sensor to become inactive again and restart the timer...:thinking:

Yes, correct, it is typically used with a wired security system. I'm trying to reuse the hardwired PIR sensors for the smart home rather than adding another PIR sensor to the room.

It would be very much appreciated if a parameter for the inactive status update was made available :slight_smile:

1 Like

@mattias - I have added the optional inactivity timeout parameter to the IS_Motion.h and IS_Motion.cpp files per your request. Please grab these latest versions from my ST_Anything GitHub repository.

Here is an example of the usage, where the 5000 is 5000ms of inactivity before sending the 'motion1 inactive' message to the hub. If the sensor goes 'active' during this timer, the timer is reset and the system waits for motion to go inactive again.

  static st::IS_Motion sensor6(F("motion1"), PIN_MOTION_1, HIGH, false, 1000, 5000);

Here is the documentation

//  Summary:  IS_Motion is a class which implements the SmartThings "Motion Sensor" device capability.
//			  It inherits from the st::InterruptSensor class.
//
//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::IS_Motion sensor5(F("motion1"), PIN_MOTION, HIGH, false, 500);
//
//			  st::IS_Motion() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- byte pin - REQUIRED - the Arduino Pin to be used as a digital output
//				- bool iState - OPTIONAL - LOW or HIGH - determines which value indicates the interrupt is true
//				- bool internalPullup - OPTIONAL - true == INTERNAL_PULLUP
//				- long numReqCounts - OPTIONAL - number of counts before changing state of input (prevent false alarms)
//              - long inactiveTimeout - OPTIONAL - number of milliseconds motion must be inactive before sending update to hub (default = 0)

Give it a try and let me know if it works for your motion sensor.

1 Like

Thanks @ogiewon! I’ll give it a go tomorrow as I have just gone to bed.

1 Like

I took the opportunity to update the Hubitat drivers as well while I was at it.

The change to the IS_Motion library worked as advertised. It has now stopped pulsing and it stays active for my defined period of time. Thank you so much! :+1:

1 Like

Sorry to bother you again @ogiewon. Is there a limitation of only 10 instances of each device type on the same sketch or parent device? I've currently got a need for driving 12 relays from my Arduino UNO, but even though I've got all 12 timed relays defined and configured in the sketch, the HubDuino parent device only detects the first 10 of them. I thought I might be coming up to the memory limit of the UNO so I tried using switches instead of timed relays in the sketch. This brought down the memory usage, but the HubDuino parent still only detected the first 10 switches.

I've currently got all 12 working by using a combination of timed relays and switches. This configuration uses more memory than the other configurations, so I don't think it is a memory issue on the UNO.

If this is a limit within either the sketch or the HubDuino parent driver, is it possible to have that limit increased? I've ordered a MEGA board and on that one I was planning on connecting over 10 smoke detectors and over 10 motion detectors. I won't be able to work around this limit with these devices as easily as I could with the relays.

1 Like

I am not aware of any 10 device limit. Can you please post a copy of your sketch so I can take a look at it?

I've sent the whole code to you in a PM rather than bloating this thread. But, of particular interest is the snippet below:

 //Special sensors/executors (uses portions of both polling and executor classes)
//  static st::S_TimedRelay           sensor2(F("relaySwitch1"), 2, LOW, false, 600, 0, 1);
//  static st::S_TimedRelay           sensor3(F("relaySwitch2"), 3, LOW, false, 600, 0, 1);
//  static st::S_TimedRelay           sensor5(F("relaySwitch3"), 5, LOW, false, 600, 0, 1);
  static st::S_TimedRelay           sensor6(F("relaySwitch4"), 6, LOW, false, 600, 0, 1);
  static st::S_TimedRelay           sensor7(F("relaySwitch5"), 7, LOW, false, 600, 0, 1);
  static st::S_TimedRelay           sensor8(F("relaySwitch6"), 8, LOW, false, 600, 0, 1);
  static st::S_TimedRelay           sensor9(F("relaySwitch7"), 9, LOW, false, 600, 0, 1);
  static st::S_TimedRelay           sensorA0(F("relaySwitch8"), A0, LOW, false, 600, 0, 1);
  static st::S_TimedRelay           sensorA1(F("relaySwitch9"), A1, LOW, false, 600, 0, 1);
  static st::S_TimedRelay           sensorA2(F("relaySwitch10"), A2, LOW, false, 600, 0, 1);
  static st::S_TimedRelay           sensorA3(F("relaySwitch11"), A3, LOW, false, 600, 0, 1);
  static st::S_TimedRelay           sensorA4(F("relaySwitch12"), A4, LOW, false, 600, 0, 1);

  //Executors
  static st::EX_Switch              executor2(F("switch1"), 2, LOW, false);
  static st::EX_Switch              executor3(F("switch2"), 3, LOW, false);
  static st::EX_Switch              executor5(F("switch3"), 5, LOW, false);
//  static st::EX_Switch              executor6(F("switch4"), 6, LOW, false);
//  static st::EX_Switch              executor7(F("switch5"), 7, LOW, false);
//  static st::EX_Switch              executor8(F("switch6"), 8, LOW, false);
//  static st::EX_Switch              executor9(F("switch7"), 9, LOW, false);
//  static st::EX_Switch              executorA0(F("switch8"), A0, LOW, false);
//  static st::EX_Switch              executorA1(F("switch9"), A1, LOW, false);
//  static st::EX_Switch              executorA2(F("switch10"), A2, LOW, false);
//  static st::EX_Switch              executorA3(F("switch11"), A3, LOW, false);
//  static st::EX_Switch              executorA4(F("switch12"), A4, LOW, false);

When I run it in this configuration, it works fine, I get 12 outputs (9 timed relays and 3 switches). If I change it so that I use 12 switches or 12 timed relays instead, I only get 10 of each

I see the “issue” now... Take a look in CONSTANTS.H around line 88. When we wrote ST_Anything years ago, when implemented a 10 Sensor and 10 Executor limit for the Arduino UNO boards due to their memory limitations. Feel free to tweak constants.h as you see fit for your application.

1 Like

I've changed the sensor limit to 12 instead and it now works fine. Thanks for that hint! :+1:

Another question coming from being inexperienced with Arduino. When I compile my sketch it reports the following memory usage:

"Sketch uses 29590 bytes (91%) of program storage space. Maximum is 32256 bytes.
Global variables use 1283 bytes (62%) of dynamic memory, leaving 765 bytes for local variables. Maximum is 2048 bytes."

When the compiled code is running on the Arduino, will the memory usage be changing or will the memory usage stay the same (disregarding any issues with memory leaks etc)?

If you watch the Arduino IDE Serial Monitor display, you will see regular printouts of the amount of free memory on the board.

Ok. I haven't got a display though, so that will be hard :wink: But I take from that that memory usage will vary

I just thought of a feature request :wink: Is it possible to make the memory usage, or free memory, available in the Parent driver? (This is a tongue-in-cheek request. Feel very welcome to disregard this)

1 Like

Will do!

1 Like

Actually, it will vary some, but not much. I just can’t recall how well the free memory at runtime corresponds to the free memory reported at compile time.

I am confused by your comment that you don’t have a display... :thinking: obviously the computer you’re compiling on has a display...and that is the device that has to upload the sketch to the Arduino...so why can’t you watch the free memory in real-time?

Haha. Because this is my first attempt at doing anything with Arduino and I thought I had to have an LED display connected to the board to see the output. I've now hunted around the IDE and found the serial monitor.
However, the output I get there looks very foreign to me: "⸮⸮⸮⸮a⸮⸮?mc,1*⸮⸮034~Sޞ⸮H$⸮⸮O⸮e⸮9[M⸮*ӧ⸮e⸮⸮⸮;⸮e⸮⸮mej9Z<ꤟ⸮⸮EZK⸮1⸮⸮BeJ⸮}9 ⸮H⸮⸮šL⸮dA⸮p⸮q⸮⸮O⸮NuۓP⸮⸮s⸮⸮⸮
K⸮A'h5⸮d⸮އ!⸮⸮⸮N⸮⸮⸮x"

Is this a baud rate or encoding issue?

To answer myself - yes, this is a baud rate issue. Set it to 115200 and you'll be sweet :slight_smile: I remembered having read something about baud rates in the instructions so I hunted it out in the readme

1 Like

Bonjour

Quick question :

I do have an ADI Ocelot running my automation for almost 15 years now... The system is still have a very high WAF.

I am in a process of leaving X10 to Zigbee and Z-wave for some stuff... but the alarm system for the house is builted on Ocelot and is working very good,

I have sucessfully installed ST_Anything... (very well design product... thank you for that) but I have a problem.

Plan A was to put a wire between the Ocelot input port (from door and PIR sensors) and bring it direct to arduino. So arduino would see also the opening or closing of contact.... but it dosent.

The arduino port sees OPEN / CLOSED switching every half second (probably the refresh rate of Ocelot to go trought the script)... So I can't use the info from the port... It is worst with PIR, but door contact is not as bad.

It looks like that the Arduino is sensing the reading of the Ocelot...

I have connected my ground all toghter, I tought that was it. but it is not....

So question : Am I trying to do something that can't be done electronically or is there something that I could try to solve and use both at the same time for the sensors?

My door sensor have a resistor betbeen the contact and the input terminal... I have tryed to connect before and after the resistor with no sucess.

Thank you

Luc

I am seeing some weird Servo Detach behavior:

So I have 3 x servos connected to 1 ESP8266 controlling the tilt of 3 blinds. In HE I have the 3 blinds in a group. In the Sketch, the Executor sets Detach to True.

The issue: Every now and the, upon completing a servo move to a new position, that servo would snap to some random position. Then, when the next move is initiated, that servo would first snap back to where it was supposed to be, and then proceed to the new position at the slower rate I have specified in the Device page.

Observations:
The serial monitor shows the move and detach complete prior to the snap, and no further messages. This happens to singular servos or the group. Also happens to a different brand of servo, with only 2 servos connected to an ESP8266. It happens randomly to any of the servos. The position they snap to varies, and is also random. The frequency of the snaps is random - sometimes could happen with 2 consecutive moves or other times could happen after 10 . . .

Now I could of course set Detach to False, but would prefer not to do so just yet. I have 3 beefy servos, all on 1 ESP and 1 power supply, and would want to reduce idle current, also keeping the servos cooler (with no air flow in the enclosed blinds). In addition, I have noticed the servos "chattering" while at the extreme open/closed position of the blinds.

Any ideas?