ztalbot2000 / homebridge-cmd4

CMD4 Plugin for Homebridge - Supports ~All Accessory Types & now all Characteristics too
Apache License 2.0
145 stars 14 forks source link

[Bug] linkedTypes not cached #130

Closed crbyxwpzfl closed 2 years ago

crbyxwpzfl commented 2 years ago

I use the linkedTypes to combine two lights together into one device. This works very good. But when I restart homebridge the Light2/seconde device/linkedType device is no longer responding. I need to clear the cache for the Device via homebridge settings first. After that the Light2/seconde device/linkedType device works again.

You helped me a lot of times at this point and I really feel greatfull for that! I have no idea how big this issue is and I can easaly clear the cache after reboots. anyway Thank you verymuch for your work and this amzing plugin!

Config:

"platform": "Cmd4",
"name": "Cmd4", 
"debug": false,
"accessories": [{
    "type": "Lightbulb",
    "displayName": "Light1",
    "on": 0,
    "stateChangeResponseTime": 1,
    "brightness": 100,
    "hue": 200,
    "saturation": 100,
    "state_cmd": "...",
    "polling": [... ],
    "linkedTypes": [{
        "type": "Lightbulb",
        "displayName": "Light2",
        "on": 0,
        "brightness": 0,
        "stateChangeResponseTime": 1,
        "state_cmd": "...",
        "polling": [... ]
        }]
    }]

Environment:

ztalbot2000 commented 2 years ago

Hi,

Interesting. It should be as a linked accessory is created just like any other. I can see why homebridge may not think so though. If I think I know what may be happening, it will take a bit of fixing. I do know that Unit testing Homebridge's caching over restarts was very tricky and I never really manage it. I may have time today. Stay tuned for further updates.

Ttyl, John

On Sat, Apr 9, 2022 at 5:49 AM f, @.***> wrote:

Assigned #130 https://github.com/ztalbot2000/homebridge-cmd4/issues/130 to @ztalbot2000 https://github.com/ztalbot2000.

— Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/130#event-6401093708, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX2OWAHOXKRFDQCESW3VEFHBPANCNFSM5S6X6YYQ . You are receiving this because you were assigned.Message ID: @.***>

crbyxwpzfl commented 2 years ago

thank you! hey is there a way to support you? Do you have PayPal?

ztalbot2000 commented 2 years ago

hi, I do this for fun. no charge, but thanks.

From what I can tell, you are correct. I used your config, cleared the .persist and accessories sub folders from .homebridge. I see the all important debug message adding get?set Priority values. however after shutting down and restarting, the linked types are added, but I do not see these messages. I will have to investigate further. so far I just reproduced it on my Mac

take care, John Talbot

crbyxwpzfl commented 2 years ago

ok thanks again haha and thanks for the update really appreciate your efforts

ztalbot2000 commented 2 years ago

Hi,

So I'm still looking into it. When Cmd4 creates the devices service initially, it works as you know. Upon restore, the service is created by homebridge and it fails to work. I'm still investigating. Sorry for the delay as I'm deep in the bowels of homebridge.

ztalbot2000 commented 2 years ago

interesting how some times writing the problem out gives you ideas. I just had a working restart based on reading some documentation on what I described to you. here's hoping that I found the real answer.

ztalbot2000 commented 2 years ago

can you please try 6.3.0-beta.1

crbyxwpzfl commented 2 years ago

hi just did a couple restarts and all worked!! wow you are quick! this is so cool of you that you care so much even about niche issues like this! just came home and tried your update sorry for the late answer.

ztalbot2000 commented 2 years ago

Hi,

Your quite welcome. I will release it officially tomorrow. I have the group of AdvantageAir people checking it over. They are heavy Cmd4 users and I helped them with their plugin that uses Cmd4. I'm surprised they never caught this, but so glad you did.

Ttyl, John

On Wed, Apr 13, 2022 at 2:50 PM f, @.***> wrote:

hi just did a couple restarts and all worked!! wow you are quick! this is so cool of you that you care so much even about niche issues like this! just came home and tried your update sorry for the late answer.

— Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/130#issuecomment-1098375009, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCXYKUW3TNB22BA45FADVE4JOVANCNFSM5S6X6YYQ . You are receiving this because you were mentioned.Message ID: @.***>

mitch7391 commented 2 years ago

@ztalbot2000 I have not tried this beta out yet sorry! Yes, I am very surprised we have not noticed the issue yet. As far as I am aware, we have had no issue with linkedTypes. I am using a Thermostat with a linkedType Fan and I believe Ung Sing is using a Fan with a linkedType Switch from memory.

ztalbot2000 commented 2 years ago

Hi Mitch,

It's okay on my Beta.

I just merged my branch to your beta branch. I had to use no-verify because when you made changes to server.js for worm2, you broke the unit tests. I'm assuming you did it from GitHub and not from within SourceTree or another git tool on Linux. Otherwise everything else passes.

I'll fix what you broke tomorrow.

Ttyl, John

On Fri, Apr 15, 2022 at 3:18 PM Mitch Williams @.***> wrote:

@ztalbot2000 https://github.com/ztalbot2000 I have not tried this beta out yet sorry! Yes, I am very surprised we have not noticed the issue yet. As far as I am aware, we have had no issue with linkedTypes. I am using a Thermostat with a linkedType Fan and I believe Ung Sing is using a Fan with a linkedType Switch from memory.

— Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/130#issuecomment-1100303794, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX7A7ZXLT7WHADWEMR3VFG6HNANCNFSM5S6X6YYQ . You are receiving this because you were mentioned.Message ID: @.***>

ztalbot2000 commented 2 years ago

Hi Mitch,

I just merged the Unit tests that broke because of the messages changed from WoRm to WoRm2. I also added one more test that I noticed could be done.

Beta branch is now up to date with all my changes.

Ttyl, John

On Fri, Apr 15, 2022 at 8:22 PM John Talbot @.***> wrote:

Hi Mitch,

It's okay on my Beta.

I just merged my branch to your beta branch. I had to use no-verify because when you made changes to server.js for worm2, you broke the unit tests. I'm assuming you did it from GitHub and not from within SourceTree or another git tool on Linux. Otherwise everything else passes.

I'll fix what you broke tomorrow.

Ttyl, John

On Fri, Apr 15, 2022 at 3:18 PM Mitch Williams @.***> wrote:

@ztalbot2000 https://github.com/ztalbot2000 I have not tried this beta out yet sorry! Yes, I am very surprised we have not noticed the issue yet. As far as I am aware, we have had no issue with linkedTypes. I am using a Thermostat with a linkedType Fan and I believe Ung Sing is using a Fan with a linkedType Switch from memory.

— Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/130#issuecomment-1100303794, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX7A7ZXLT7WHADWEMR3VFG6HNANCNFSM5S6X6YYQ . You are receiving this because you were mentioned.Message ID: @.***>

crbyxwpzfl commented 2 years ago

really great! thank you very much! so I close this right haha

ztalbot2000 commented 2 years ago

Hi,

I just published v6.3.0 officially. I will close the ticket if it is not already.

Take care, John Talbot

On Sat, Apr 16, 2022 at 2:49 AM f, @.***> wrote:

really great! thank you very much! so I close this right haha

— Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/130#issuecomment-1100588605, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX36OCBWIZTIPECV2RLVFJPI3ANCNFSM5S6X6YYQ . You are receiving this because you were mentioned.Message ID: @.***>

ztalbot2000 commented 2 years ago

Hi,

Just to let you know I merged into master test/Cmd4PlatformRestartTests.js, a unit test that proves the fix previously provided. It just means that future changes will make sure this fix is still working.

take care, John Talbot

crbyxwpzfl commented 2 years ago

hi your communication is really great! just updated the plugin to master again and everything works very well. hope you have a nice weekend!