@Core_Phx Says unexpected token in json at position 0
{
“enableHTTPserver”: true,
“hubs”: [
{ “name”: “Living Room”, “ip”: “192.168.5.200” },
{ “name”: “Next one”, “ip”: “192.168.5.201” },
{ “name”: “Next one”, “ip”: “192.168.5.202” }
]
}
Does this work? (I haven’t had time to download and test the code yet).
Arrg, does not work either, so close. I am able to link up the 1 hub and have it working in ST, the TV turns on and off. So so close!!!
Weird. I was looking over the changes that he made and it looks like he just made changes to the timeouts. When you run it, does it say Starting Manual mode?
Also, you are changing the names and IP addresses, right?
Can you share your config.json code as well?
LOL, that’s funny… you’re using \opt on a Windows system. That’s awesome mate.
Here you go.
This is what works.
{
“enableHTTPserver”: true,
“hubs”: [
{
“name”: “Living”,
“ip”: “192.168.5.200”
}
]
}
This is what does not work
{
“enableHTTPserver”: true,
“hubs”: [
{ “name”: “Living Room”, “ip”: “192.168.1.170” },
{ “name”: “Bedroom”, “ip”: “192.168.1.167” },
{ “name”: “Guest Room”, “ip”: “192.168.1.207” }
]
}
Hmmmm, looking at the error, it seems to be something in the way the file has been saved. What are you using to edit the file?
I am using note pad. But that is what I always use, so should not be the case.
Yeah, I would agree with that. Notepad is about as generic as you can get. Looking at the error, it’s not parsing the JSON properly.
Here’s the code that actually parses and pulls out the hubs. The problem is that it isn’t even getting this far to parse the config.
if (config.hasOwnProperty(“hubs”) && Array.isArray(config.hubs)) {
config.hubs.forEach(function(hub) {
harmony(hub.ip).then(function(client){
console.log(‘Starting Manual mode.’)
startProcessing(parameterize(hub.name), client)
})
})
It works on the single hub in manual, but I cannot even get discovery mode to work using the below. I get a similar error.
For Discovery Mode (default config) :
{
“enableHTTPserver”: true,
}
When you set it back to the single hub, are you editing the file or just renaming the original config? I’m almost done with my work stuff, so I’ll be able to download it and see if I can figure it out.
I saved the working one on my desktop and am just copying and pasting the file. I have 2 the original and the one I am messing with. Both named config.json, one is in the desktop the other is in the config folder. Just pasting over the bad one with the good one. That way I don’t mess up the one that is actually working.
Also, good news is the single hub is fully working. I use a program called AlwaysUp instead of forever. But I just rebooted the PC and Harmony API was up and running when I logged into the PC. Yeah it cost me a little bit of $$$ but I could never figure out forever on any of my node servers and I have a few running. That is why I got frustrated, when I already have other servers running on windows and this one just refuses to work.
Ok. REALLY odd. It’s working here. Honestly? I’m stumped and I don’t say that often. The changes between my system and yours:
I’m using Notepad2 for my editor.
Windows 10 version:
D:\testhapi\harmony-api>node --version
v8.9.3
D:\testhapi\harmony-api>npm --version
5.6.0
This is my config:
{
“enableHTTPserver”: true,
“hubs”: [
{ “name”:“Office”, “ip”:“192.168.1.9” },
{ “name”:“Bedroom”, “ip”:“192.168.1.10” },
{ “name”:“Living Room”, “ip”:“192.168.1.21” }
]
}
You know what really sucks. I am at work doing all of this from my phone using remote desktop into my PC. So bear with me, I am creating the json on my work pc, emailing it to my house. Then have to login with the phone to do the server.
Give me a couple minutes and I will see if i messed something up and create a brand new file and try that.
LOOOOOL
LMAO!!! Seriously?! That’s SICK (and awesome all at the same time).
What? Did I miss something? Also, I just tried exactly what you are using and no go.
{
“enableHTTPserver”: true,
“hubs”: [
{ “name”:“Living Room”, “ip”:“192.168.170.” },
{ “name”:“Bedroom”, “ip”:“192.168.1.167” },
{ “name”:“Guest Room”, “ip”:“192.168.1.207” }
]
}
What in gods name am I doing wrong. I don’t want to give up with one hub. I Need at least the living room and guest room, I can do without the Bedroom.
LOL
Huh… wait a tic… something you said just gave me an idea. You are creating the file on your work PC and then emailing it home and putting it in the directory? I wonder if that’s messing up the file. I know it’s going to be a pain in the ass, but can you create the file on your home computer (even over your rdp session) and see what happens? I’m willing to bet that somewhere along the line, the encoding of the file and/or the JSON encoding is getting messed up. That is seriously all I can think of.
We’re going to get you working. If it’s working with one hub on the original config, then it’s a problem with the file (physically the file) itself. Not your JSON.