Supereg / homebridge-http-switch

Powerful http switch for Homebridge: https://github.com/homebridge/homebridge
ISC License
219 stars 36 forks source link

statusPattern ESPEasy #29

Closed Rabelbeat closed 5 years ago

Rabelbeat commented 5 years ago

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

image

LOG:

image

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:

    {
        "accessory": "HTTP-SWITCH",
        "name": "EspEasy",
        "switchType": "stateful",
        "pullInterval": 3000,
        "onUrl": {
            "url": "http://192.168.1.52/control?cmd=GPIO,12,1",
            "method": "POST"
        },
        "offUrl": {
            "url": "http://192.168.1.52/control?cmd=GPIO,12,0",
            "method": "POST"
        },
        "statusUrl": {
            "url": "http://192.168.1.52/control?cmd=Status,GPIO,12",
            "method": "GET"
        },
        "statusPattern": "{\n\"log\":[abc] ,\n\"plugin\":[0-9],\n\"pin\":[0-9],\n\"mode\":[abc],\n\"state\":1\n}",
        "debug": true
    }

Hope that someone can Help

Supereg commented 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:

Rabelbeat commented 5 years ago

@Supereg You are awesome!!

"statusPattern": "\"state\": 1" Solve the problem

Thanks for the quick response and detailed explanation You Rock!