Homebridge Plug-in


#245

Nah, I commented out that console.log (which didn't work), so maybe I did something to the index.js file when I did that. Just reloaded the plugin though and it's all working. Homebridge config is still intact and arranged just as I left it.


#246

Ok, I'm sorry you have run into some trouble. I could change the port it's listening on back and forth all night long and it wouldn't make a difference. No point in trying to convince me that has anything to do with it.

You backed up before testing? If you didn't I'm sorry you made that error. I have suffered that enough times myself.


#247

I couldn't care less if you are convinced or not. It's ALL I CHANGED and everything got trashed, period.


#248

I too am sorry you ran into trouble. I have too, many times. Way too many times. Through that hard learned lesson, I found that saving the two directories: accessories and persist, when the horror occurs, you have a backup. Put those saved directories back, and it comes back. Perhaps you have a system level backup you can use ?

Back on post #192 of this thread, I reminded SmartHomePrimer to save the files,

In your .homebridge directory, there's two subdirectories: accessories and persist. Copy those somewhere safe. Then do the upgrade/restart.

and then again a few posts later, I warned of HomeKit's unpredictable deleting:

...but copying them so they could be copied back. One of the issues is that something triggers HomeKit to delete all the devices and room assignments.

I recognize that you weren't actively participating around that time, and may not have read that part of the thread.


#249

I didn't delete any directories. The exact same directories were still there when I ONLY changed the port to 8005 based on, clearly bad, suggestions.


#250

I looked again and I didn't find any use of the word "delete" in reference to those directories. Copy for backup - yes. So they can be put back, yes. There's no accusation that YOU deleted them, it's already known that Homebridge/HomeKit zeros out the files within those directories, leaving the directories intact. It's not your fault Homebridge/HomeKit does that. The only workaround we have is to backup the directories, so they can be put back on those occasions when any of us get bit.


#251

They don't need to be "put back" if they were never removed! Again, and I don't know how many times I need to repeat myself, all I did was to change the port to 8005 and restart homebridge.. BAM! Devices gone...


#252

But alas they were removed as your persistent files probably have changed. HomeKit is very finicky.

FYI this is an issue with HomeKit in general. You remove a hub, upgrade a hub, look wrong at the hub and all your stuff is gone. I know your pain, frustration and total disgust as I experienced it initially before doing ST or HE with Hue and HK. Hence why I only use it now as another voice controller for home automation and another presence controller.


#253

We agree, you didn't change anything but the port and BAM everything is gone.. we agree 100% with that.

No need to repeat that again, because I do understand, you just changed the port.

BUT

What you didn't know is that Homebridge/HomeKit WILL zero out the files (not delete, although the difference is null for the effect.) Your configuration was deleted FOR you, not BY you. I don't know why, I have never been able to predict it. It does happen, it probably will happen again. The workaround that's known is to have a saved copy of the two directories so that the CONTENTS of the files can be restored.


#254

For the last time... Nothing got removed. I'm done arguing... You guys assume I made all kinds of deletions and crap. ALL I DID was change the port from 8000 to 8005 because someone thought it should be 8005 when the documents clearly state it should be 8000!


#255

Man, please stop being pissed off and READ what everyone is telling you. Dang dude you are now beyond rude with your lack of listening/reading. Noone said YOU deleted anything. Everyone is telling you that this is what HomeKit and homebridge does. It sucks it does this and the lessons learned from everyone that HAS HAD THE SAME PROBLEM AS YOU has stated you need to have a backup of those two directories INCASE homebridge resets itself (NOT YOU) and you lose all of your configurations.

Stop being triggered, listen to what the community is trying to help you with and then move forward with a solution to prevent this from happening in the future.


#256

For anyone reading this thread in the future, there are a couple of things you can do that will pretty well save your hide with Homebridge. It's finicky to changes and as mentioned in this thread, even HomeKit itself is tempramental if you change something with the Homebridge files.

Changing plug-in settings should be fine. I've never enountered an issue changing a plugin setting.

  1. Backup! Spend any time on this forum and you'll see accounts of people praising Hubitat for saving their hides with auto backup. Homebridge doesn't have that feature built-in. So backup the config.json file, the persist and accessories directories. That will save your hide in just about every case. If HomeKit is suddenly not configured the way it was before, you can simply stop homebridge and replace the persist and accessories directories, then restart homebridge and your HomeKit configuration should come back.

Note: If you're on a Mac like I am, you can simply use time machine backup to always have a copy of the persist and accessories directories to revert to. Or there are many applications out there that can auto-backup a single or set of directories.

If you're on a Raspberry Pi, make an image of your SD card. You can then restore in about 5 minutes if you have an issue with your configuration. Or again, use an application to make an auto backup of those directories and the config.json file.

  1. Never change the Homebridge port! Doing so will destroy your setup. I think you can restore the persist and accessories directories if you go back to the exact same port number they were setup on before, but I'm not certain and won't be testing that one :grin: I mean, I could and then revert to my time machine backup if it didn't recover when I reverted the config.json, persist and accessories directories, but I don't have the time for that. Just don't do it. Have a full backup to revert to.

@tonesto7 does say on his repo that the plug-in listens on port 8000 by default, but he doesn't say to set it to that. Just that it's default. Well this thing is, that's default on ST, so I believe this is old information that may need updating where HE users are concened. If you put nothing in the config.json file to tell it otherwise, it will default to 8005. The index.js file has that specified in it. I do recall discussion around changing that port for HE, but I don't recall the reason. If you force the port to 8000, it'll still work, but there may be a conflict. Just can't recall what it was.

Changing the plug in port is done via the Confi.json file by adding direct_port to the Hubitat section of your config.json file as shown below, but you should be able to just leave the port unspecified and it will default to 8005. Never change the port number in the Homebridge section. Change that, and even restoring your persist and accessories directories from backup won't help, unless you change back to the exact same port (which you get by also backup up the config.json file). However, I'll reiterate that I have made that mistake and I don't recall if just reverting the port and directories was enough. Best to just never change the homebridge port once things are setup. Only change ports for plugins when needed.

    {
        "bridge": {
            "name": "Homebridge",
            "username": "{my username}",
            "port": 51826,  **<- Never change this port number.**
            "pin": "xxx-xx-xxx"
        },
        
        "description": "JSON API",
        "platforms": [
            {
                "platform": "Hubitat",
                "name": "Hubitat",
                "app_url": "http://192.168.1.144/apps/api/616/",
                "access_token": "{my token}",
       "direct_ip": "10.0.0.70",
       "direct_port": 8000 **<- This is where you change the port for the plugin, but you don't need this unless port 8005 is a conflict with something else.**
            }
        ]
    }

#257

It won't help now but 1) Tonesto7's github README is still SmartThings centric. The instructions work well enough for Hubitat, but the examples, etc. are still SmartThings. And 2) tonesto7 has "merged" the > SmartThings and Hubitat into one code base and there's a line:

        this.direct_port = (platformName === 'SmartThings' ? 8000 : 8005);

That sets port 8000 for SmartThings and for everything else gets port 8005 as the default ports. We know the reason is so that both Smart Things and Hubitat can run together. 'hubitat' does not equal 'SmartThings' and thus Hubitat's default is 8005.


#258

That was it. It was the hub link and other hub integrations in particular that came up at the time it was being ported. Thanks for jogging my memory.


#259

Not being rude, just stating facts. You guys assume I did something wrong when I didn't. Now I'm done... Assume what you want, I don't care. And I promise I will never take any of your advice again for Homebridge...


#260

Oh please, let him be.

More words aren't going to help. He's not reading.


#261

I have version checking in all of my app except Homebridge. I didn't see the need to add more bloat.

I'm sorry for all of the issues this is causing...

I've revised the readme some to correct any inconsistencies


#262

It's not me who is "not reading". Read the install docs and you'll see it's port 8000. It should have never been suggested that I try 8005. Sadly I was foolish enough to try someone's bad advice.


#263

If you know where it says that it “should be port 8000” not that it “defaults to port 8000” for Hubitat, then you can help others by posting a link to that so @tonesto7 can correct that, since that is incorrect information if it says “should be”. The only bad advice is not to back up, and no one gave you that advice. Quite the opposite, many times.


#264

Tony updated the README and now "default: 8005" is there in the Hubitat section.