Homebridge troubleshooting

You’ve made a mistake in the configuration file :speak_no_evil:

The platforms array holds various platform JSON objects, and should look something like this:

"Platforms" : [
  {
    "Platform": "configuration",
    "setting2": "Yada Yada",
  },
  {
    "Platform":"Particle",
    "setting2": "lorum ipsum"
  }
]

Notice how each platform is its own JSON object (inbetween the { } brackets.)

1 Like

Oh, I see! :rofl:

This is my config.json file:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:39",
        "port": 51826,
        "pin": "031-45-154"
    },
    
    "description": "Configuration file with one Particle platform with 3 accessories: 2 lights, 1 temperature sensor. Access token = Filip's, device id = Particle",

    "platforms":
    [
        {
		"platform": "config",
      	"name": "Config",
      	"port": 8080,
      	"sudo": true
		},
        {
        "platform": "Particle",
		"name": "Particle Devices",
		"access_token": "mytoken",
		"cloudurl": "https://api.spark.io/v1/devices/",
		"devices":
			[
				{
				"accessory": "ParticleLight",
				"name": "D7",
				"deviceid": "mydevice",
				"type": "LIGHT",
				"function_name": "onoff",
				"args": "0={STATE}"
				},
				{
				"accessory": "ParticleLight",
				"name": "D1",
				"deviceid": "mydevice",
				"type": "LIGHT",
				"function_name": "onoff",
				"args": "1={STATE}"
				},
				{
				"accessory": "ParticleTemperature",
				"name": "Temperature",
				"deviceid": "mydevice",
				"type": "SENSOR",
				"sensorType": "temperature",
				"key": "temperature",
				"event_name": "tvalue"
				}
			]
        }
    ]
}

I suppose that’s OK now?

Remark that I changed in the above config.json to:
“port”: 8080,
“sudo”: true

That was a tip in the installation instructions… and it connects now!
This is what I get on the RPi:

Tonight I will discover how it works…

Thanks Jordy!
:clap::older_man:

1 Like

Great! Homebridge works very stable and reliable now,
and the graphical UI for controlling the server is also very handy!

Thanks @makerken and @Moors7 for your fantastic guidance. I could not have done it without this great community...

Switching lights ON and OFF with Siri has no secrets for me anymore.
But now I'm trying to explore the communication possibilities in the other direction:

Reading sensors...

From the sample "config.json" file, I kept this "device":

               {
                    "accessory": "ParticleTemperature",
                    "name": "Room Temperature",
                    "deviceid": "222042000b47348882313031999",
                    "type": "SENSOR",
                    "sensorType": "temperature",
                    "key": "temperature",
                    "event_name": "tvalue"
                }

And I read @krvarma's explanation:

Based on this, I tried various combinations of Particle.publish commands, such as:

Particle.publish("tvalue", "key=37",60,PRIVATE);

But the value shown in the Apple HOME App does not change: It shows 20° continuously...
Any experience with this somebody?

Edit: Applying the bold text above, I found the correct syntax for the event to publish:

Particle.publish("tvalue", "temperature=37",60,PRIVATE);

All works now! Thanks @krvarma

:wave::older_man:

Beyond me. I’ll have to checkout the GUI, looks like things have come a long way since I did it. I don’t have any experience with sensor types, just controlling on/off, and my sketch would have a state variable so I could cycle through light patterns.

I have a project upcoming that I want temperature/humidity readings from so I could be learning it.

1 Like

I've been studying an interesting add-on to this UI:

Till now I could not make that work...


Interesting!
That's what I was also looking for...

How do you achieve this?

Looking at code 2 or 3 years old.

It looks like I just did the normal toggle sketch but added a state variable. Abridged, I haven’t run this code:

int toggle = 0;  // controls on/off
int state = 0;   // controls which pattern

void loop() {

    if(toggle == 1) {

        if(state == 3) {  // resets the state to the number of patterns you have
           state = 0
        }

        if(state == 0) {
          patternPart();
          strip.show();
        }

        if(state == 1) {
          pattern2Part();
          strip.show();
        }

        if(state == 2) {
          pattern3Part();
          strip.show();
        }

        delay(1000);

    } else {
        strip.clear();
        strip.show();
    }

}

int onoffLight(String command)
{
    toggle = command.toInt();
    if(toggle == 1) {
       state += 1;
    }
    return 0;
}

Remember to not block your code in a loop playing one single pattern in a loop, it needs to do the part and then delay to connect to the cloud.

Thanks for looking up your old sketch @makerken!
That’s clear, but what I really like to understand is: How does your device / accessory look in the config.json file for the Homebridge server to give you 2 variables?
And which device is visible in the Home App?
:thinking:

@Moors7: Do you use also these "Accessories" with the UI?
I tried to activate them by running Homebridge in -I (insecure) mode but no visible result yet...

That would be a solution also for my previous question to @makerken...
:wave::older_man:

Homebridge just gives an on/off, the other dumb state logic is in my sketch. Toggle turns on/off, state controls which pattern is showing.

Start:
Toggle = 0 // off
State = 0 // pattern

First switch:
Toggle = 1 // on
State = 1

Second switch:
Toggle = 0 // off
State = 1

Third switch:
Toggle = 1 // on
State = 2

Keep following the logic, I’ve had three patterns, it only changes what pattern when I turn it on/off, no directly controlling which pattern. It only is ever controlling a single bool (int above makes it seem like more than it is, it should be bool). Haven’t looked at it in forever.

OK, got it!
But it must be possible to get different states from other accessories in Homebridge. I’m surprised this is not documented…

I hope to find out with that wonderful graphical UI found by @Moors7

I think it depends on the relevant plug-in what the capabilities are. The Yeelights I have do report their status (when changed with something other than Homebridge). It’s all in the coding. Fortunately, you can make/edit plug-ins to your heart’s contempt, though that might not be the easiest thing to do, admittedly.

1 Like

OK, understood…
So, I suppose the only person who could answer these questions is @krvarma, the maker of the Homebridge plugin for Particle.

@Moors7: Did you manage to see the “accessories” in that Homebridge Graphic UI?
:wave::older_man:

For your information: I have just discovered there is an update for the Particle plugin for homebridge: homebridge-particle-io v0.0.12, made by Norman Thomas:

NPM

GITHUB
It also seems to support Humidity sensors now… :pray:


I did not try it out yet, as my Home (with 10 Photons) runs perfectly with the older version…

If someone will try this, it would be great to read your experience here!
I could not find Norman Thomas here, but I’d like to thank him for his work!!!

1 Like

Thanks you for your information. But my concern is that how can I use the plugins and accessories of Home bridge application. I am using it in one of my project like research paper writer page but unable to use those plugins. Looking for support.