I have been modifying a child/parent example driver from @mike.maxwell (Generic Component Parent Demo), trying to get multiple child switches under a single parent. It would help if I had a driver I could lean from that already had multiple switches. Can anyone point me to a multiple-switch parent/child driver I can play with?
They are not multiple switches but my sendmail v3 parent device creates and deletes multiple child devices.
/**
* simple sendmail .. lg kahn kahn@lgk.com
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* v 2.1 added desciprtive text and cleaned up debugging
* v 2.2 added hostname option and lookup ip if blank.
* v 2.3 added better checking for end of send to make sure it is closing cleanly
* v 2.4 add serial queueing so that a new connect waits while old finishes.. set timeout to 1 minute to wait. if email is not finished by
* then close connection and start new one. Also add state.lastCommand to follow the attribute as that seems more reliable.
* to this function telling me socket is closed but it obviously is not because responses are still asynchronously coming basck after!
* This "Stream is closed" messages seems to always come out after the quit command so it appears to be a status message not really an error
* v 2.4.2. try to workaround the check i had for the goodbye/bye message .. I was checkiong the value string on code 221 which was not a good
* approach as various servers can return differnent strings here. Unfortunately 221 just means remote server is closing so need to checkt
* that the message was sent and it is 221,
* v 2.4.3 true concurrency and queue using a thread safe data structure concurrentlinkedqueue and also mutex (thanks to erktrek)
* tested with up to 8 messages
* When one message finishes it checks the queue, and delivers any other remaining.. also schedules a rerun when busy and one is added to the queue.
* also serialize the setting and checking of the state.lastCommand as this is used to keep track of the async status of the commands
*
This file has been truncated. show original
1 Like
mbishop
December 27, 2022, 8:47pm
3
You could look at Single Active Switch , a parent which creates many child switches and ensures at most one is on at any time.
2 Likes
Did you try the Hubitat official Github? There are many examples in there.
1 Like
I was able to add my 3 child switches that trigger MQTT on/off requests back through the parent.
Thanks for the help!!
1 Like
system
Closed
December 30, 2023, 2:15pm
6
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.