toblum / McLighting

The ESP8266 based multi-client lighting gadget
MIT License
1.05k stars 291 forks source link

Homebridge/Home Assistant Switch & get_switch parameter #9

Closed markbajaj closed 7 years ago

markbajaj commented 7 years ago

HI Tobias,

Thanks for all your work! Great update.

I am having a small issue with the http:///get_switch. Basically it always returns a 1, whether the LEDs are on or off. Is this because the /off command just changes the colour to RGB 0 0 0 ?

I have tried turning the brightness to 0, RGB to 0 and mode to 0 and the return is still 1. The issue here is that I have added it to home bridge and the status always shows on. I also use Home Assistant and have added a command line switch, again the status is always on so I have had to remove the status line.Below is a snippet from my Homebridge code:

            {
                    "accessory": "HTTP-RGB",
                    "name": "strip",

                    "switch": {
                            "status": "http://IP/get_switch",
                            "powerOn": "http://IP/all?r=255&g=255&b=255",
                            "powerOff": "http://IP/off"
                    },

                    "brightness": {
                            "status": "http://IP/get_brightness",
                            "url": "http://IP/set_brightness?p=%s"
                    },

                    "color": {
                            "status": "http://IP/get_color",
                            "url": "http://IP/all?rgb=%s",
                            "brightness": true
                    }
            }

Here is my command line switch in Home Assistant:

- platform: command_line
    switches:
    light_strip:
      command_on: "/usr/bin/curl -X GET http://IP/all?r=255&g=255&b=255"
      command_off: "/usr/bin/curl -X GET http://IP/off"
      command_state: "/usr/bin/curl -X GET http://IP/get_switch"
      value_template: '{{ return_value == 1 }}'

Do you have any ideas on how I can report the status?

Thanks.

toblum commented 7 years ago

Dear @markbajaj, I think I'll have to look into this, but as a quick fix you could try to comment out that line: https://github.com/toblum/McLighting/blob/master/Arduino/McLighting/McLighting.ino#L363

That should fix the problem for now.

markbajaj commented 7 years ago

Perfect!!! worked a treat!!!!! Thanks.

toblum commented 7 years ago

Fixed in: https://github.com/toblum/McLighting/commit/33804de86e01e339afa9451fd6fb0ed73de149c1

markbajaj commented 7 years ago

Thanks for fixing it :)

I also have added code for OTA updates in the Arduino IDE - where would I share those?

Thanks

Mark

On 10 Feb 2017, at 10:01, Tobias Blum notifications@github.com wrote:

Dear @markbajaj https://github.com/markbajaj, I think I'll have to look into this, but as a quick fix you could try to comment out that line: https://github.com/toblum/McLighting/blob/master/Arduino/McLighting/McLighting.ino#L363 https://github.com/toblum/McLighting/blob/master/Arduino/McLighting/McLighting.ino#L363 That should fix the problem for now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/toblum/McLighting/issues/9#issuecomment-278903877, or mute the thread https://github.com/notifications/unsubscribe-auth/AV2G8omODpiklEoYS7HWf8bD_8E5NZWcks5rbDV6gaJpZM4L9H_V.

toblum commented 7 years ago

@markbajaj Having OTA support would be great. You could file this as a pull request in Github. That would be great.