Closed Maxmudjon closed 7 years ago
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
plase example file config.json please send me
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.
HOW TO WRITE ?
topic: homebridge/to/add payload: {"name": "flex_lamp", "service": "Switch"}
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
you have example accessory ?
you have a ready-made accessory, such as lamp control ?
Sorry, I tried my best describing the API and the examples in the wiki. Maybe some other user can help you.
{ "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"} ] }
I write the code correctly
No you need to send accessories through mqtt not the config file. Read about mqtt and json.
HELP how i can add accessory to config.js please example