Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HELP how i can add accessory to config.js #17

Closed
Maxmudjon opened this issue Nov 22, 2016 · 11 comments
Closed

HELP how i can add accessory to config.js #17

Maxmudjon opened this issue Nov 22, 2016 · 11 comments

Comments

@Maxmudjon
Copy link

HELP how i can add accessory to config.js
please example

@cflurin
Copy link
Owner

cflurin commented Nov 22, 2016

config.js is only used for defining the platform and the MQTT broker!
Accessories can be added (and removed) at runtime.
Take a look at README and Wiki

@Maxmudjon
Copy link
Author

plase example file config.json please send me

@cflurin
Copy link
Owner

cflurin commented Nov 22, 2016

As in README explained:

{
	"bridge": {
		"name": "homebridge",
		"username": "CC:22:3D:E3:CE:31",
		"port": 51826,
		"pin": "031-45-154"
	},
	"platforms": [
		{
		"platform":"mqtt",
		"name":"mqtt",
		"url":"mqtt://your_broker_ip",
		"username":"your_name",
		"password":"your_password"
		}
	],
	"accessories": []
}

Create a file config.json in your homebridge dir on a Raspberry e.g. home/pi/.homebridge
and paste the def above.

@Maxmudjon
Copy link
Author

HOW TO WRITE ?

topic: homebridge/to/add
payload: {"name": "flex_lamp", "service": "Switch"}

@cflurin
Copy link
Owner

cflurin commented Nov 22, 2016

Hmmm! To use homebridge-mqtt you should have knowledge about MQTT, MQTT-broker. Google is your friend e.g.:
http://www.hivemq.com/blog/mqtt-essentials-part-1-introducing-mqtt

@Maxmudjon
Copy link
Author

you have example accessory ?

@Maxmudjon
Copy link
Author

you have a ready-made accessory, such as lamp control ?

@cflurin
Copy link
Owner

cflurin commented Nov 23, 2016

Sorry, I tried my best describing the API and the examples in the wiki.
Maybe some other user can help you.

@Maxmudjon
Copy link
Author

{
"bridge": {
"name": "homebridge",
"username": "CC:22:3D:E3:CE:31",
"port": 51826,
"pin": "031-45-154"
},
"platforms": [
{
"platform":"mqtt",
"name":"mqtt",
"url":"mqtt://your_broker_ip",
"username":"your_name",
"password":"your_password"
}
],
"accessories": [
topic: homebridge/to/add
payload: {"name": "Lampa", "service": "Switch"}
]
}

@Maxmudjon
Copy link
Author

I write the code correctly

@maragelis
Copy link

No you need to send accessories through mqtt not the config file. Read about mqtt and json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants