nfarina / homebridge-dummy

Dummy switches for Homebridge: https://github.com/nfarina/homebridge
267 stars 81 forks source link

Switch not being triggered when used in automations #18

Open okonet opened 4 years ago

okonet commented 4 years ago

I’m a bit lost here so please bear with me. I’m adding a simple stateful switch to hold a Boolean variable for my vacuum cleaner (Cleaned today) which i trigger via an automation: when vacuum is set to “on”, change switch to “on”. But it doesn’t work at all. I tried doing the same with some of my lights and other appliances and they work just fine. Only the switch state remains the same. I’m not sure if that’s a homekit bug and would appreciate any feedback here.

I tried using shortcuts app to create a shortcut, I added another plugin with a stateful switch with no luck at all. I’m also have a similar issue when using another switch that should trigger another switch that comes from broadlink RM plugin. So it seems to me to be related to HomeKit but I’m sure it was working before. Please help!

okonet commented 4 years ago

Actually looking at the homebridge log reveals that it works but switches the switch back to off right away. See the screenshot:

42986AE5-3B12-4668-B23B-8305F38BDD4C

okonet commented 4 years ago

That’s my config:

{
            "name": "Cleaned Today",
            "stateful": true,
            "accessory": "DummySwitch"
        }
RCdiy commented 4 years ago

Does using any other working switch work with the Vac? If it works say with lights temporarily see if it will work with the vac.

okonet commented 4 years ago

Yes, the automation works with lights. I just tried triggering another switch by it and it worked as well.

RCdiy commented 4 years ago

So lets say "Dummy Light" is controlled in Home when "Lutron Light" turns on and WORKS. "Dummy Cleaned Today" is controlled in Home when "Neato" turns on and does NOT work.

Test if this works "Dummy Cleaned Today" is controlled in Home when "Lutron Light" turns on - does it work? "Dummy Light" is controlled in Home when "Neato" turns on - does it work?

okonet commented 4 years ago

Sorry for misunderstanding but the Dummy Light doesn’t work either. I just tested both examples you asked and none worked with the dummy switch / light.

okonet commented 4 years ago

I also updated time to 3000 and it applied with stateful: true

74655A95-045C-4D20-89FD-B37747B3B523 CB592B92-1D03-4A6F-9543-2815F1996F09

okonet commented 4 years ago

Ah actually that log entry comes from “Test this scene”. So if I just try switching on a light that controls the dummy switch, it doesn’t appear in the log at all

RCdiy commented 4 years ago

These are mine accessories": [ { "name": "Backyard Dummy", "stateful": true, "reverse": false, "time": 0, "accessory": "DummySwitch" }, { "name": "Front Outside Dim 50 For 60s", "stateful": false, "reverse": false, "time": 60000, "accessory": "DummySwitch" },

okonet commented 4 years ago

I just tried this automation with this config:

{
            "name": "Cleaned Today",
            "stateful": true,
            "time": 10000,
            "accessory": "DummySwitch"
        },
        {
            "name": "Test Dummy",
            "stateful": true,
            "reverse": false,
            "time": 0,
            "accessory": "DummySwitch"
        }

179F6D4B-C428-4BCA-8A0F-63849AE560B9

And it didn’t work. Does it work for you?

RCdiy commented 4 years ago

See

https://share.icloud.com/photos/05C6N6nvv_wtpFR4VS4xNxaHg

https://user-images.githubusercontent.com/20209851/72100869-64ed4580-32f1-11ea-9460-64abe5eb2da5.jpeg

RCdiy commented 4 years ago

https://share.icloud.com/photos/0d4LLi8rl_MrI9bL-in2PlO0g It works. I did not wait for cleaned today to turn off. https://user-images.githubusercontent.com/20209851/72102133-42106080-32f4-11ea-9142-756e4e4d0557.png https://user-images.githubusercontent.com/20209851/72102134-42106080-32f4-11ea-8f12-fbd33690b446.png

okonet commented 4 years ago

That’s so weird! I’m blaming Apple TV hub here but I’m not sure how do I even debug this since Apple doesn’t give much information.

okonet commented 4 years ago

Thanks for sharing anyways. I’ll keep digging and post here if I find something.

RCdiy commented 4 years ago

I'm using Apple TV as well :) Pi But was on my Mac mini for a day or two.

RCdiy commented 4 years ago

One one occasion I found I had to push each dummy individually before they would work. I also use the web UI.

llamafilm commented 4 years ago

I think this is the same problem for me. The dummy switch works when triggered by Siri or by tapping in the Home app. It does not work when triggered by an automation, and nothing is written to the debug log. I'm using code like the example.

"accessories": [
        {
          "accessory": "DummySwitch",
          "name": "My Switch 1",
          "time": 5000
        }
    ]
okonet commented 4 years ago

I figured out that the problem was with the homebridge installation. Moving the plugin to a separate new instance of homebridge solved it. I’m still not sure what the root cause. Maybe clearing caches will help to resolve it.

llamafilm commented 4 years ago

@okonet what is the difference between your two homebridge instances? Mine runs on a Pi Zero. I wonder if slow CPU could be part of the problem.

okonet commented 4 years ago

None! I run them on same device via docker. I think it’s something with cache. Not sure.