codetwice / homebridge-http-securitysystem

Homebridge plugin that creates a SecuritySystem device which uses configurable HTTP calls to set and get its state.
BSD 2-Clause "Simplified" License
29 stars 17 forks source link

Help with mappers #32

Closed benepixx closed 2 years ago

benepixx commented 2 years ago

Hi, I think im being a moron, but hoping someone can show me where Im going wrong:

State is returned as "table.DisableLinkage.Enable=true" (Or false dependant on state)

Ive got a regex and a static mapper them but the debug output just shows the mappers passing the whole thing on to the next mapper.

See output:

28/05/2022, 11:05:11] [CCTV Alarm] Mapper 0 mapped table.DisableLinkage.Enable=false to table.DisableLinkage.Enable=false

[28/05/2022, 11:05:11] [CCTV Alarm] Mapper 1 mapped table.DisableLinkage.Enable=false to table.DisableLinkage.Enable=false

See attached section of mapper config.

"readCurrentState": { "url": "http://192.168.10.11/cgi-bin/configManager.cgi?action=getConfig&name=DisableLinkage", "body": "" }, "readTargetState": { "url": "http://192.168.10.11/cgi-bin/configManager.cgi?action=getConfig&name=DisableLinkage", "body": "" } }, "mappers": [ { "type": "regex", "parameters": { "regexp": "\"Enable=\": (\\d)" } }, { "type": "static", "parameters": { "mapping": { "false": "0", "true": "3" } } } ] }

Can anyone tell me where im going wrong?

benepixx commented 2 years ago

Nevermind. my Regex was miles off. (?:(false|true)) Works perfectly.

codetwice commented 2 years ago

Good job sorting it out yourself :)