NorthernMan54 / homebridge-cmd-television

20 stars 1 forks source link

Timer to poll status and update HomeKit more frequently? #17

Open CGDaveMac opened 2 years ago

CGDaveMac commented 2 years ago

I was trying to add a timer into this plugin to run getPowerState every every X seconds so that HomeKit is updated more frequently. I am making some Automations based on the status of this accessory, and currently the status only updates when the Home app is opened.

I am not that proficient in coding these types of devices, and I was able to add in a setTimeout (I read SetInterval could backup and cause too many calls) but after the first loop I am getting a crash. Can someone help identify the best place to add this?

If successful, I would like to recommend an option be added into the config to set this status check, or I can fork the code.