Skip to content

Commit 37042b7

Browse files
authored
Merge pull request #17 from nutechsoftware/sm-dev
Next release 1.0.6 P6 improve and fix Twilio.
2 parents 2fc7fe6 + b3a7f2f commit 37042b7

File tree

9 files changed

+385
-312
lines changed

9 files changed

+385
-312
lines changed

CHANGELOG.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
6-
7-
## [1.0.6 P5] - 2021-01-10
8-
- [X] CORE: Improve names of components in menu config build.
9-
- [X] STSTK: DSC panels have no special command to disarm just the code is used. Sending the code while armed disarms and while disarmed will arm. To deal with this quirk on DSC if the panel is already DISARMED and the ST Disarm button is pushed the code will not send anything to the panel.
10-
## [Unreleased] WIP
6+
## [Unreleased] Open issues
7+
- [ ] CORE: Certificate store or some way to avoid having to store fixed static public keys for twilio, pushover and other REST api plugins.
118
- [ ] CORE: FIXME: Setting HOST NAME when using static IP over ethernet not working.
129
- [ ] CORE: FIXME: reboot of esp32 causes connected ser2sock clients to hang. So far various attempts to fix have been unsuccessful. Will need to do some network captures to determine the problem.
1310
- [ ] CORE: HUP/RESTART needs to be centralized so cleanup ex(_fifo_destroy) can happen first. How to connect with STSDK having its own restart calls.
@@ -23,16 +20,26 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2320
- [ ] CORE: TODO: better hardware abstraction. Need to remove _esp_ specific code to make it easier to port to other hardware. Trying to keep the code as POSIX as possible with the limited resources I have.
2421
- [ ] CORE: TODO: ```'ping'``` command could come in handy. Again today needed this with ST MQTT servers seeming to be down.
2522
- [ ] STSDK: TODO: Add SmartThings Zone devices.
26-
## [1.0.6 P4] - 2021-01-08
23+
## [Unreleased] WIP Sean Mathews @f34rdotcom
24+
- [X] CORE: Move log mode init.
25+
- [X] API: Event format string for no match case to show event ID.
26+
- [X] CORE: Modify changelog(this file) to include info for blame.
27+
- [X] TWILIO: Fix syntax use newer format used in pushover module. Add simple HTTP response testing and and reporting to aid in setup.
28+
- [X] PUSHOVER & TWILIO: Fix bug in NV storage. Someday cleanup and make the prefix an arg to the NV routines. Would require less use if 'key' var but would it be easier to read?
29+
- [X] TWILIO: Update api.twilio.com public key. Uggg! This already changed :(. I need allow update of this key via CLI and I need to find a way to get the key to lookup the root certificate...
30+
## [1.0.6 P5] - 2021-01-10 Sean Mathews @f34rdotcom
31+
- [X] CORE: Improve names of components in menu config build.
32+
- [X] STSTK: DSC panels have no special command to disarm just the code is used. Sending the code while armed disarms and while disarmed will arm. To deal with this quirk on DSC if the panel is already DISARMED and the ST Disarm button is pushed the code will not send anything to the panel.
33+
## [1.0.6 P4] - 2021-01-08 Sean Mathews @f34rdotcom
2734
- [ ] CORE: ad2term arg to reset AD2 device and then start the terminal. Any argument string will send hold the reset line on the AD2pHat board low for 1 second as the terminal is started causing the AD2* to hard reset. Useful when firmware on the AD2* gets corrupted and its hard to get into the boot loader.
28-
## [1.0.6 P3] - 2021-01-08
35+
## [1.0.6 P3] - 2021-01-08 Sean Mathews @f34rdotcom
2936
- [X] CORE: Consolidate some common functions from Twilio and Pushover clients into ad2_utils functions.
3037
- [X] PUSHOVER: New notification component Pushover.net. A simple HTTPS request much like SendGrid or Twilio but I prefer this command format and will be changing other commands to match soon.
31-
## [1.0.6 P2] - 2020-12-29
38+
## [1.0.6 P2] - 2020-12-29 Sean Mathews @f34rdotcom
3239
- [X] CORE: refactor where serial starts to allow to enter ad2term mode early before any other code starts. This allows to update firmware over the USB cable in ad2term mode using the GUI app or other AD2* firmware update tool.
33-
## [1.0.6 P1] - 2020-12-21
40+
## [1.0.6 P1] - 2020-12-21 Sean Mathews @f34rdotcom
3441
- [X] OTA: Some change in mbedtls happend at some point causing OTA to now fail. Releaseing P1 to fix.
35-
## [1.0.6] - 2020-12-19
42+
## [1.0.6] - 2020-12-19 Sean Mathews @f34rdotcom
3643
- [X] SER2SOCKD: Add new component ser2sock daemon.
3744
- [X] README
3845
- [X] CMD
@@ -41,7 +48,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4148
- [X] QA/TESTING
4249
- [X] API: Refactor api. Simplify subscriber storage class. Add new subscriber callback type. Added ON_RAW_RX_DATA so subscribers can get a raw AD2* stream needed by ser2sockd to avoid writing in ser2sock client and uart client routines.
4350
- [X] CORE: Extract ser2sock fragments and move into ser2sock component.
44-
## [1.0.5] - 2020-12-15
51+
## [1.0.5] - 2020-12-15 Sean Mathews @f34rdotcom
4552
- [X] CORE: Tidy: Improve Kconfig menuconfig.
4653
- [X] API: System specific nibble was a bit. Fixed.
4754
- [X] API: ON_LOW_BATTERY() toggle ON/OFF with no battery on on test panel. This one keeps poping up...
@@ -58,7 +65,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
5865
- [X] TWILIO: Missed log refactor after serialize refactor. No logic changes.
5966
- [X] TWILIO: Fix ~250 byte memory leak in Twilio json code.. No logic changes.
6067
- [X] CORE: tidy.
61-
## [1.0.4] - 2020-11-08
68+
## [1.0.4] - 2020-11-08 Sean Mathews @f34rdotcom
6269
- [X] CORE: Tidy QA testing.
6370
- [X] TWILIO: Improve docs and ```twsas``` command report format as valid commands with comments.
6471
- [X] TWILIO: Need to add ability to trigger on common states FIRE, ALARM, DISARM, ARM, CHIME etc in new twsas command.
@@ -84,7 +91,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
8491
- [X] API: FIX: Improve FIRE and ALARM tracking issue with state toggle.
8592
- [X] TWILIO: TODO: Add class based command line configurable notifications to Twilio. Allow to enable/disable event messages for different event types.
8693

87-
## [1.0.3 P2 WIP] - 2020-10-31 (no release)
94+
## [1.0.3 P2 WIP] - 2020-10-31 (no release) Sean Mathews @f34rdotcom
8895
- [X] API: New class AD2EventSearch and support functions to subscribe. I spent a few days on this. A bit of a unicorn hunt. I could write discrete API and CLI code for every possible message type from the AlarmDecoder protocol but this seems excessive. The task is the same on every message so a single CLI and API to create custom tracking of all messages using REGEX and simple state logic was what I ended up with. This new class when constructed becomes a virtual contact with OPEN/CLOSE/FAULT states. These states are updated based upon user supplied regex patterns and simple user provided logic hints.
8996
- [X] API: RFX message expand hex to bin for easy parsing.
9097
- [X] API: Added message type tracking during parse for post processing.
@@ -98,14 +105,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
98105
- [X] STSDK: Wired BYPASS to the bypass component contact capability.
99106
- [X] STSDK: remove battery fault contact from device profile in ST dev portal.
100107

101-
## [1.0.3 P1] - 2020-10-20
108+
## [1.0.3 P1] - 2020-10-20 Sean Mathews @f34rdotcom
102109
- [X] CORE: Add command feedback to commands that require a restart to take effect.
103110
- [X] STSDK: Remove restart for enable. Add warnings about restarting.
104111
- [X] CORE: Fix: build error JSON.h issue using esp4.x.
105112
- [X] STSDK: Fix: Not enabling by default.
106113
- [X] TWILIO: Fix: mbedtls_x509_crt_parse is broken when building esp 4.x with return code -0x2180. The PEM parsing routine expects the last byte to be null but under 4.x build it is `-`. Using EMBED_TXTFILES automatically puts a \0 at the end of the block of memory and it is included in the size of the buffer. This is the setting that is used in the 3.x build component mk file.
107114

108-
## [1.0.3] - 2020-10-19
115+
## [1.0.3] - 2020-10-19 Sean Mathews @f34rdotcom
109116
- [X] STSDK: Improve: Connect Panic Alarm and Medical Alarm buttons each requires 3 taps with 5 second timeout.
110117
- [X] STSDK: Improve: Connect DISARM button.
111118
- [X] STSDK: Improve: Connect ARM STAY, ARM AWAY buttons.
@@ -130,7 +137,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
130137
- [X] CORE: Fix deprecated stsdk api calls.
131138
- [X] CORE: Fix: building with espidf 4.x Currently testing only on 3.x branch but will switch to 4.x as soon as some warnings are sorted out.
132139

133-
## [1.0.2] - 2020-10-11
140+
## [1.0.2] - 2020-10-11 Sean Mathews @f34rdotcom
134141
- [X] CORE: New: Command: ```'netmode <[W,E,N]> <ARGS>'```. If SmartThings is disabled allow control of network settings.
135142
- [X] CORE: Improve: Add util function ```ad2_query_key_value``` for N/V parsing. Will be used to store settings in NV in a easy to use text only way.
136143
- [X] CORE: Improve: Filled in empty wifi init function and added ```hal_event_handler```.
@@ -147,16 +154,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
147154
- [X] STSDK: Fix: Finish wiring smokeDetector capability and test FIRE alarm to show if smoke/clear events.
148155
- [X] STSDK: Tidy: Function name fix ```connection_start_task```.
149156

150-
## [1.0.1 p1] - 2020-09-27
157+
## [1.0.1 p1] - 2020-09-27 Sean Mathews @f34rdotcom
151158
- [X] - Added support code for 'C' mode connection.
152159
- [X] - Refactor 'ad2source' command to allow selecting GPIO UARTS TX/RX pins.
153160
- [X] - New command 'ad2term' to connect directly to AD2* and stop processing.
154161
- [X] - Adding a ad2_* string util for splitting strings. Still needs const char * override.
155162

156-
## [1.0.1] - 2020-09-25
163+
## [1.0.1] - 2020-09-25 Sean Mathews @f34rdotcom
157164
- [X] Code formatting and Travis CI setup on github. What a mess :)... "astyle --style=otbs"
158165

159-
## [1.0.0B] - 2020-09-18
166+
## [1.0.0B] - 2020-09-18 Sean Mathews @f34rdotcom
160167

161168
Refactor to take all dev work and clean it up into components that can be turned off / on as needed for a given project.
162169
Changes and tests.
@@ -178,7 +185,7 @@ Changes and tests.
178185
- [X] OTA: Add subscriber callback for ON_FIRMWARE_VERSION
179186
- [X] REFACTOR: Started adding event id string formats for human readable.
180187

181-
## [1.0.0] - 2020-09-18
188+
## [1.0.0] - 2020-09-18 Sean Mathews @f34rdotcom
182189

183190
Initial project release for testing.
184191

README.md

Lines changed: 68 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -279,66 +279,56 @@ Configure the notifications using the notification components CLI commands.
279279
- [c] Close output format string.
280280
- [f] Fault output format string.
281281

282-
### Twilio notification commands
283-
- Sets the 'Account SID' for notification.
282+
### Configuration for Twilio message notifications.
284283

285-
```twsid {slot} {hash}```
284+
- Sets the 'SID' for a given notification slot. Multiple slots allow for multiple twilio accounts.
285+
286+
```twilio sid {slot} {hash}```
286287

287288
- {slot}: [N]
288-
- For default use 0. Support multiple Twilio accounts.
289-
- {hash}: Twilio 'Account SID'. SendGrid 'KEY Name' or user defined N/A.
289+
- For default use 0.
290+
- {hash}: Twilio 'Account SID'.
290291

291-
Example: twsid 0 aabbccdd112233..
292+
Example: twilio sid 0 aabbccdd112233..
292293

293-
- Sets the 'User Auth Token' for notifications.
294+
- Sets the 'Auth Token' for a given notification slot.
294295

295-
```twtoken {slot} {hash}```
296+
```twilio token {slot} {hash}```
296297

297298
- {slot}: [N]
298-
- For default use 0. Support multiple Twilio accounts.
299-
- {hash}: Twilio 'User Auth Token'. SendGrid 'API KEY'.
300-
301-
Example: twtoken 0 aabbccdd112233..
302-
303-
- Sets the 'Type' for notification.
299+
- For default use 0.
304300

305-
```twtype {slot} {type}```
301+
- {hash}: Twilio 'Auth Token'.
306302

307-
- {slot}
308-
- For default use 0. Support multiple accounts.
309-
- {type}: [M|C|E]
310-
- Notification type [M]essage, [C]all, [E]mail.
303+
Example: twilio token 0 aabbccdd112233..
311304

312-
Example: twtype 0 M
305+
- Sets the 'From' info for a given notification slot.
313306

314-
- Sets the 'From' address for notification.
307+
```twilio from {slot} {phone|email}```
315308

316-
```twfrom {slot} {phone} ```
309+
- {phone|email}: [NXXXYYYZZZZ|[email protected]]
317310

318-
- {slot}: [N]
319-
- For default use 0. Support multiple Twilio accounts.
320-
- {phone}: [NXXXYYYZZZZ]
321-
- From phone #
311+
- Sets the 'To' info for a given notification slot.
322312

323-
Example: twfrom 0 13115552368
313+
```twilio to {slot} {phone|email}```
324314

325-
- Sets the 'To' address for notification.
315+
- {phone|email}: [NXXXYYYZZZZ|[email protected]]
326316

327-
```twto {slot} {phone}```
317+
- Sets the 'Type' for a given notification slot.
328318

329-
- {slot}: [N]
330-
- For default use 0. Support multiple Twilio accounts.
331-
- {phone}: [NXXXYYYZZZZ]
332-
- To phone #
319+
```twilio type {slot} {type}```
333320

334-
Example: twto 0 13115552368
321+
- {type}: [M|C|E]
322+
- Notification type [M]essage, [C]all, [E]mail.
323+
Example: type 0 M
335324

336325
- Define a smart virtual switch that will track and alert alarm panel state changes using user configurable filter and formatting rules.
337326

338-
```twsas {slot} {setting} {arg1} [arg2]```
327+
```twilio switch {slot} {setting} {arg1} [arg2]```
339328

340329
- {slot}
341330
- 1-99 : Supports multiple virtual smart alert switches.
331+
342332
- {setting}
343333
- [N] Notification slot
344334
- Notification settings slot to use for sending this events.
@@ -349,7 +339,7 @@ Configure the notifications using the notification components CLI commands.
349339
- [T] Message type filter.
350340
- {arg1}: Message type list seperated by ',' or empty to disables filter.
351341
- Message Types: [ALPHA,LRR,REL,EXP,RFX,AUI,KPM,KPE,CRC,VER,ERR,EVENT]
352-
- For EVENT type the message will be generated by the API and not the AD2.
342+
- For EVENT type the message will be generated by the API and not the AD2
353343
- [P] Pre filter REGEX or empty to disable.
354344
- [O] Open(ON) state regex search string list management.
355345
- {arg1}: Index # 1-8
@@ -368,91 +358,91 @@ Configure the notifications using the notification components CLI commands.
368358
- Configure notification profiles..
369359
```console
370360
# Profile #0 EMail using api.sendgrid.com
371-
twsid 0 NA
372-
twtoken 0 Abcdefg012345....
373-
374-
375-
twtype 0 E
361+
twilio sid 0 NA
362+
twilio token 0 Abcdefg012345....
363+
twilio from 0 [email protected]
364+
twilio to 0 [email protected]
365+
twilio type 0 E
376366

377367
# Profile #1 SMS/Text message using api.twilio.com
378-
twsid 1 Abcdefg012345....
379-
twtoken 1 Abcdefg012345....
380-
twfrom 1 15555551234
381-
twto 1 15555551234
382-
twtype 1 M
368+
twilio sid 1 Abcdefg012345....
369+
twilio token 1 Abcdefg012345....
370+
twilio from 1 15555551234
371+
twilio to 1 15555551234
372+
twilio type 1 M
383373

384374
# Profile #2 Voice Twiml call using api.twilio.com
385-
twsid 2 Abcdefg012345....
386-
twtoken 2 Abcdefg012345....
387-
twfrom 2 15555551234
388-
twto 2 15555551234
389-
twtype 2 C
375+
twilio sid 2 Abcdefg012345....
376+
twilio token 2 Abcdefg012345....
377+
twilio from 2 15555551234
378+
twilio to 2 15555551234
379+
twilio type 2 C
390380
```
391381
- Send notifications from profile in slot #0 for 5800 RF sensor with SN 0123456 and trigger on OPEN(ON), CLOSE(OFF) and FAULT REGEX patterns. In this example the Text or EMail sent would event contain the user defined message.
392382
```console
393383
Twilio SmartSwitch #1 report
394384
# Set notification slot [N] to #0.
395-
twsas 1 N 0
385+
twilio switch 1 N 0
396386
# Set default virtual switch state [D] to 'CLOSED'(0)
397-
twsas 1 D 0
387+
twilio switch 1 D 0
398388
# Set auto reset time in ms [R] to 'DISABLED'
399-
twsas 1 R 0
389+
twilio switch 1 R 0
400390
# Set message type list [T]
401-
twsas 1 T RFX
391+
twilio switch 1 T RFX
402392
# Set pre filter REGEX [P]
403-
twsas 1 P !RFX:0123456,.*
393+
twilio switch 1 P !RFX:0123456,.*
404394
# Set 'OPEN' state REGEX Filter [O] #01.
405-
twsas 1 O 1 !RFX:0123456,1.......
395+
twilio switch 1 O 1 !RFX:0123456,1.......
406396
# Set 'CLOSED' state REGEX Filter [C] #01.
407-
twsas 1 C 1 !RFX:0123456,0.......
397+
twilio switch 1 C 1 !RFX:0123456,0.......
408398
# Set 'FAULT' state REGEX Filter [F] #01.
409-
twsas 1 F 1 !RFX:0123456,......1.
399+
twilio switch 1 F 1 !RFX:0123456,......1.
410400
# Set output format string for 'OPEN' state [o].
411-
twsas 1 o RF SENSOR 0123456 OPEN
401+
twilio switch 1 o RF SENSOR 0123456 OPEN
412402
# Set output format string for 'CLOSED' state [c].
413-
twsas 1 c RF SENSOR 0123456 CLOSED
403+
twilio switch 1 c RF SENSOR 0123456 CLOSED
414404
# Set output format string for 'FAULT' state [f].
415-
twsas 1 f RF SENSOR 0123456 FAULT
405+
twilio switch 1 f RF SENSOR 0123456 FAULT
416406
```
417407
- Send notifications from profile in slot #2 in the example a Call profile when EVENT message "FIRE ON" or "FIRE OFF" are received. Use a Twiml string to define how the call is processed. This can include extensive external logic calling multiple people or just say something and hangup.
418408
```console
419409
Twilio SmartSwitch #2 report
420410
# Set notification slot [N] to #2.
421-
twsas 2 N 2
411+
twilio switch 2 N 2
422412
# Set default virtual switch state [D] to 'CLOSED'(0)
423-
twsas 2 D 0
413+
twilio switch 2 D 0
424414
# Set auto reset time in ms [R] to 'DISABLED'
425-
twsas 2 R 0
415+
twilio switch 2 R 0
426416
# Set message type list [T]
427-
twsas 2 T EVENT
417+
twilio switch 2 T EVENT
428418
# Set 'OPEN' state REGEX Filter [O] #01.
429-
twsas 2 O 1 FIRE ON
419+
twilio switch 2 O 1 FIRE ON
430420
# Set 'CLOSED' state REGEX Filter [C] #01.
431-
twsas 2 C 1 FIRE OFF
421+
twilio switch 2 C 1 FIRE OFF
432422
# Set output format string for 'OPEN' state [o].
433-
twsas 2 o <Response><Say>Notification alert FIRE ALARM</Say></Response>
423+
twilio switch 2 o <Response><Say>Notification alert FIRE ALARM</Say></Response>
434424
# Set output format string for 'CLOSED' state [c].
435-
twsas 2 c <Response><Say>Notification alert FIRE CLEAR</Say></Response>
425+
twilio switch 2 c <Response><Say>Notification alert FIRE CLEAR</Say></Response>
436426
```
437427
- Send notifications from profile in slot #2 in the example a Call profile when EVENT message "POWER BATTERY" or "POWER AC" are received. Use a Twiml string to define how the call is processed. This can include extensive external logic calling multiple people or just say something and hangup.
438428
```console
439429
Twilio SmartSwitch #3 report
440430
# Set notification slot [N] to #2.
441-
twsas 3 N 2
431+
twilio switch 3 N 2
442432
# Set default virtual switch state [D] to 'CLOSED'(0)
443-
twsas 3 D 0
433+
twilio switch 3 D 0
444434
# Set auto reset time in ms [R] to 'DISABLED'
445-
twsas 3 R 0
435+
twilio switch 3 R 0
446436
# Set message type list [T]
447-
twsas 3 T EVENT
437+
twilio switch 3 T EVENT
448438
# Set 'OPEN' state REGEX Filter [O] #01.
449-
twsas 3 O 1 POWER AC
439+
twilio switch 3 O 1 POWER AC
450440
# Set 'CLOSED' state REGEX Filter [C] #01.
451-
twsas 3 C 1 POWER BATTERY
441+
twilio switch 3 C 1 POWER BATTERY
452442
# Set output format string for 'OPEN' state [o].
453-
twsas 3 o <Response><Say>Notification alert ON MAIN AC POWER</Say></Response>
443+
twilio switch 3 o <Response><Say>Notification alert ON MAIN AC POWER</Say></Response>
454444
# Set output format string for 'CLOSED' state [c].
455-
twsas 3 c <Response><Say>Notification alert ON BATTERY BACKUP POWER</Say></Response>
445+
twilio switch 3 c <Response><Say>Notification alert ON BATTERY BACKUP POWER</Say></Response>
456446
```
457447
- Existing search verbs. ```RFX``` and others are not useful here as they can be filtered by message type ```RFX``` directly. The more useful verbs contain a modifier such as ON/OFF. TODO: Add ZONE tracking verbs and algorithm.
458448
```

components/alarmdecoder-api/alarmdecoder_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void AlarmDecoderParser::notifySubscribers(ad2_event_t ev, std::string &msg, AD2
186186
// convert event to human readable string and state OPEN/CLOSE/FAULT
187187
std::string emsg;
188188
if (event_str.find((int)ev) == event_str.end()) {
189-
emsg = "EVENT ID %d" + std::to_string(ev);
189+
emsg = "EVENT ID " + std::to_string(ev);
190190
} else {
191191
emsg = event_str[(int)ev];
192192
}

0 commit comments

Comments
 (0)