Closed Rabelbeat closed 5 years ago
The fast solution: a pattern like "statusPattern": "\"state\": 1"
would work, since it is probably enough to match that part with the state in it.
But I also wanted to answer why your first pattern does not work. The following parts are problematic:
[abc]
would match ONE character which must be a
, b
or c
. This definitely won't match the two empty quotes (""
) nor the word output in quotes ("quotes"
). Something like \"[A-Za-z]*\"
should work. Firstly you would need to include the quotes into the pattern. [A-Za-z]
defines the range of the whole alphabet, lowercase AND uppercase. the *
says that the part in the brackets can be repeated 0-n times.[0-9]
won't match the 12
from the pin property since this part only matches ONE digit. Something like [0-9]+
should work allowing multiple repetition of digits, but at least one. @Supereg You are awesome!!
"statusPattern": "\"state\": 1"
Solve the problem
Thanks for the quick response and detailed explanation You Rock!
Hi I'm using Sonoff basic with ESPEasy firmware and I'm unable to get the ON/OFF status.
Status Link: http://192.168.1.52/control?cmd=Status,GPIO,12
LOG:
Tested patterns:
"statusPattern": "{\n\"log\":[abc] ,\n\"plugin\":[0-9],\n\"pin\":[0-9],\n\"mode\":[abc],\n\"state\":1\n}"
Also try
"statusPattern": "{\n \"log\": ,\n\"plugin\":1, \n\"pin\":12, \n\"mode\":output, \n\"state\":1\n}"
And
"statusPattern": "{\"log\": ,\"plugin\":1, \"pin\":12, \"mode\":output, \"state\":1}"
And many more pattern options, no metter what, still I get Switch is currently OFF even when the state is 1
Full Config:
Hope that someone can Help