ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
901 stars 91 forks source link

homebridge-hue mqtt #323

Closed papko7 closed 6 years ago

papko7 commented 6 years ago

Hi I am trying to set up my smart home via Raspberry Pi and homebridge. I already did temperature and humidity sensor. But now i bought Philips Hue light and I would like to connect to my home. I change my config.json

{
        "bridge": {
                "name": "Homebridge",
                "username": "CC:22:3D:E3:CE:30",
                "port": 51826,
                "pin": "031-45-154"
        },
        "description": "Nastavenie Homebridge pre domacu siet..",

        "platforms": [{

                "platform": "mqtt",
                "name": "mqtt",
                "url": "mqtt://127.0.0.1",
                "topic_prefix": "homebridge"
      },
{
      "platform": "Hue",
        "users": {
        "001788FFFExxxxxx": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "001788FFFEyyyyyy": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
      },      "lights": true
    }
]
}

I am using mqtt for sending data via module. Can you help me how can i add philips hue to the system? When I turn on homebridge it give me this error

[2018-3-30 14:54:01] Loaded plugin: homebridge-hue
[2018-3-30 14:54:01] Registering platform 'homebridge-hue.Hue
[2018-3-30 14:54:01] ---
[2018-3-30 14:54:02] Loaded plugin: homebridge-mqtt
homebridge API version: 2.2
[2018-3-30 14:54:02] Registering platform 'homebridge-mqtt.mqtt
[2018-3-30 14:54:02] ---
[2018-3-30 14:54:02] Loaded config.json with 0 accessories and 2 platforms.
[2018-3-30 14:54:02] ---
[2018-3-30 14:54:02] Loading 2 platforms...
[2018-3-30 14:54:02] [mqtt] Initializing mqtt platform...
[2018-3-30 14:54:02] [mqtt] homebridge-mqtt v0.4.7
[2018-3-30 14:54:02] [Hue] Initializing Hue platform...
[2018-3-30 14:54:03] [Hue] homebridge-hue v0.8.8, node v8.11.1, homebridge v0.4.38
[2018-3-30 14:54:03] [Hue] warning: not using recommended node version v8.10.0 LTS
[2018-3-30 14:54:03] [mqtt] Number of cached Accessories: 3
[2018-3-30 14:54:03] [mqtt] clientId = homebridge-mqtt_81773c26
[2018-3-30 14:54:03] [mqtt] Connecting..
[2018-3-30 14:54:03] [mqtt] connected (url = mqtt://127.0.0.1)
[2018-3-30 14:54:05] [Hue] dresden appspot ipv6: communication error ENETUNREACH on https://dresden-light.appspot.com/
[2018-3-30 14:54:11] [Hue] 192.***.***.100: bridge request 1: get /config
[2018-3-30 14:54:11] [Hue] 192.***.***.100: bridge communication error EHOSTUNREACH on 192.***.***.100
[2018-3-30 14:54:13] [Hue] 192.***.***.101: bridge request 1: get /config
[2018-3-30 14:54:13] [Hue] 192.***.***.101: bridge communication error EHOSTUNREACH on 192.***.***.101
ebaauw commented 6 years ago

The first communication error is probably because you don't have IPv6 Internet connectivity. It can safely be ignored. The other two communication errors indicate homebridge-hue thinks there's two bridges at addresses 192.x.x.100 and 192.x.x.101, but they're not responding. I need to see the debug log to know why homebridge-hue thinks there's bridges at these addresses. See https://github.com/ebaauw/homebridge-hue#debug-log-file.

papko7 commented 6 years ago

Hi, firstly thanks for your answer Here is information from homebridge.log

`-- Logs begin at Mon 2018-04-02 19:30:48 UTC, end at Mon 2018-04-02 19:35:28 UTC. --
Apr 02 19:30:50 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Apr 02 19:30:50 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Apr 02 19:30:50 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Apr 02 19:30:50 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Apr 02 19:31:00 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Apr 02 19:31:00 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Apr 02 19:31:00 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Apr 02 19:31:00 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Apr 02 19:31:00 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Apr 02 19:31:00 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Apr 02 19:31:11 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Apr 02 19:31:11 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Apr 02 19:31:11 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Apr 02 19:31:11 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Apr 02 19:31:11 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Apr 02 19:31:11 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Apr 02 19:31:29 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Apr 02 19:31:29 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Apr 02 19:31:29 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Apr 02 19:31:29 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Apr 02 19:31:29 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Apr 02 19:31:29 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Apr 02 19:31:39 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Apr 02 19:31:39 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Apr 02 19:31:39 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Apr 02 19:31:39 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Apr 02 19:31:39 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Apr 02 19:31:39 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Apr 02 19:31:49 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Apr 02 19:31:49 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Apr 02 19:31:49 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Apr 02 19:31:49 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Apr 02 19:31:49 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Apr 02 19:31:49 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Apr 02 19:31:59 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Apr 02 19:31:59 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Apr 02 19:31:59 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Apr 02 19:31:59 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Apr 02 19:31:59 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Apr 02 19:31:59 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Apr 02 19:32:09 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.

When I used homebridge -D 2>&1 | tee homebridge.log it gave me this log

root@raspberrypi:~/.homebridge# homebridge -D 2>&1 | tee homebridge.log
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
[2018-4-2 19:38:02] Loaded plugin: homebridge-hue
[2018-4-2 19:38:02] Registering platform 'homebridge-hue.Hue'
[2018-4-2 19:38:02] ---
[2018-4-2 19:38:03] Loaded plugin: homebridge-mqtt
homebridge API version: 2.2
[2018-4-2 19:38:03] Registering platform 'homebridge-mqtt.mqtt'
[2018-4-2 19:38:03] ---
[2018-4-2 19:38:03] Loaded config.json with 0 accessories and 2 platforms.
[2018-4-2 19:38:03] ---
[2018-4-2 19:38:03] Loading 2 platforms...
[2018-4-2 19:38:03] [mqtt] Initializing mqtt platform...
[2018-4-2 19:38:03] [mqtt] homebridge-mqtt v0.4.7
[2018-4-2 19:38:03] [mqtt] storagePath = /root/.homebridge
[2018-4-2 19:38:03] [mqtt] config = {"platform":"mqtt","name":"mqtt","url":"mqtt://127.0.0.1","topic_prefix":"homebridge"}
[2018-4-2 19:38:03] [Hue] Initializing Hue platform...
[2018-4-2 19:38:03] [Hue] homebridge-hue v0.8.8, node v8.11.1, homebridge v0.4.38
[2018-4-2 19:38:03] [Hue] warning: not using recommended node version v8.10.0 LTS
[2018-4-2 19:38:03] [Hue] npm registry: get /homebridge-hue
[2018-4-2 19:38:03] [mqtt] Accessory.configureAccessory 'Teplota' 'Teplota'
[2018-4-2 19:38:03] [mqtt] Accessory.configureCharacteristics Teplota Teplota Name Teplota
[2018-4-2 19:38:03] [mqtt] Accessory.configureCharacteristics Teplota Teplota CurrentTemperature 21
[2018-4-2 19:38:03] [mqtt] Accessory.configureAccessory 'Vlhkost' 'Vlhkost'
[2018-4-2 19:38:03] [mqtt] Accessory.configureCharacteristics Vlhkost Vlhkost Name Vlhkost
[2018-4-2 19:38:03] [mqtt] Accessory.configureCharacteristics Vlhkost Vlhkost CurrentRelativeHumidity 62
[2018-4-2 19:38:03] [mqtt] Accessory.configureAccessory 'living_lamp' 'light'
[2018-4-2 19:38:03] [mqtt] Accessory.configureCharacteristics living_lamp light Name light
[2018-4-2 19:38:03] [mqtt] Accessory.configureCharacteristics living_lamp light On false
[2018-4-2 19:38:03] [mqtt] Accessory.configureCharacteristics living_lamp light Brightness 100
[2018-4-2 19:38:03] [mqtt] Number of cached Accessories: 3
[2018-4-2 19:38:03] [mqtt] Controller.start
[2018-4-2 19:38:03] [mqtt] clientId = homebridge-mqtt_7adbcd49
[2018-4-2 19:38:03] [mqtt] Connecting..
[2018-4-2 19:38:04] [mqtt] connected (url = mqtt://127.0.0.1)
[2018-4-2 19:38:04] [mqtt] on.connect subscribe homebridge/to/#
[2018-4-2 19:38:04] [mqtt] on.connect homebridge-mqtt v0.4.7 started
[2018-4-2 19:38:05] [Hue] npm registry: get /homebridge-hue ok
[2018-4-2 19:38:05] [Hue] warning: lastest version: homebridge-hue v0.8.9
[2018-4-2 19:38:05] [Hue] config.json: {"platform":"Hue","users":{"001788FFFExxxxxx":"***************************************1","001788FFFEyyyyyy":"***************************************2"},"lights":true}
[2018-4-2 19:38:05] [Hue] meethue portal: get /api/nupnp
[2018-4-2 19:38:05] [Hue] dresden appspot ipv4: get /discover
[2018-4-2 19:38:05] [Hue] dresden appspot ipv6: get /discover
[2018-4-2 19:38:05] [Hue] upnp search: searching at 239.255.255.250:1900 for 5 seconds
[2018-4-2 19:38:05] [Hue] dresden appspot ipv6: communication error ENETUNREACH on https://dresden-light.appspot.com/
[2018-4-2 19:38:05] [Hue] meethue portal: get /api/nupnp ok
[2018-4-2 19:38:05] [Hue] meethue portal: found bridge 001788FFFE15D538 at 192.***.***.101
[2018-4-2 19:38:05] [Hue] meethue portal: found bridge 001788FFFE4F79BE at 192.***.***.101
[2018-4-2 19:38:05] [Hue] meethue portal: found bridge 001788FFFE78A377 at 192.***.***.100
[2018-4-2 19:38:05] [Hue] meethue portal: found bridge 001788FFFE4B5345 at 192.***.***.102
[2018-4-2 19:38:05] [Hue] dresden appspot ipv4: get /discover ok
[2018-4-2 19:38:10] [Hue] upnp search: done
[2018-4-2 19:38:10] [Hue] 192.***.***.101: bridge request 1: get /config
[2018-4-2 19:38:10] [Hue] 192.***.***.101: bridge request 1: get /config
[2018-4-2 19:38:10] [Hue] 192.***.***.100: bridge request 1: get /config
[2018-4-2 19:38:10] [Hue] 192.***.***.102: bridge request 1: get /config
[2018-4-2 19:38:13] [Hue] 192.***.***.100: bridge request 1: get /config
[2018-4-2 19:38:13] [Hue] 192.***.***.100: bridge communication error EHOSTUNREACH on 192.***.***.100
[2018-4-2 19:38:13] [Hue] 192.***.***.101: bridge request 1: get /config
[2018-4-2 19:38:13] [Hue] 192.***.***.101: bridge communication error EHOSTUNREACH on 192.***.***.101
[2018-4-2 19:38:13] [Hue] 192.***.***.101: bridge request 1: get /config
[2018-4-2 19:38:13] [Hue] 192.***.***.101: bridge communication error EHOSTUNREACH on 192.***.***.101
[2018-4-2 19:38:15] [Hue] 192.***.***.102: bridge request 1: get /config
[2018-4-2 19:38:15] [Hue] 192.***.***.102: bridge communication error ETIMEDOUT on 192.***.***.102

` If you have any tips how to solve this problem I will be so happy ! Thank you for answer :)

ebaauw commented 6 years ago

The meethue portal reports that you have four different Hue bridges?! What kind of Internet connection do you have? Are you sharing a public IP address?

Best configure the IP address of your bridge in config.json to disable discovery, see https://github.com/ebaauw/homebridge-hue/wiki/Configuration.

papko7 commented 6 years ago

I am using IPv4 connection and my internet is getting IP automatically

{
            "platform": "Hue",
                        "host": "192.168.0.10",
            "users": {
                "001788FFFExxxxxx": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "001788FFFEyyyyyy": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
            },
            "lights": true
        }

This code i put into config.json I dont know exactly what IP adress I should use it. My MQTT broekr is working on local network 127.0.0.1 My another question, users should be the same like in your tutorial ? Or what users should be there ? I am sorry for too many question but I am little bit distracted

papko7 commented 6 years ago

The meethue portal reports that you have four different Hue bridges?! What kind of Internet connection do you have? Are you sharing a public IP address?

Best configure the IP address of your bridge in config.json to disable discovery, see https://github.com/ebaauw/homebridge-hue/wiki/Configuration.

Thank you I solve the problem and now it is working perfectly :) I have another question, is it possible to connect Xiamo door sensor, I bought this one https://www.ebay.com/itm/Xiaomi-Mijia-Smart-Door-and-Windows-Sensor-Multi-Functional-Home-Security-Guard/312032695109?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

Is there any way how to properly connect to my home ? Thanks

ebaauw commented 6 years ago

I dont know exactly what IP adress I should use it

The IP address of your Hue bridge.

My another question, users should be the same like in your tutorial ? Or what users should be there ?

No, these are just examples. When you run homebridge-hue for the first time, it will ask you in the homebridge output/log to press the button on the bridge, so it can create a username. It will than log what bridgeid and username you need to put in config.json.

I have another question, is it possible to connect Xiamo door sensor

homebridge-hue supports this sensor, but the Hue bridge doesn’t. You’ll need deCONZ.
Alternatively, you could try the Mi gateway and one of the Mi homebridge plugins, but I have no experience with these. Also, you’ll need HomeKit automations instead of gateway rules to control your lights automatically. I find these are slower and less reliable than gateway rules.

papko7 commented 6 years ago

homebridge-hue supports this sensor, but the Hue bridge doesn’t. You’ll need deCONZ.

Okay So, If I will buy this RaspBee https://www.dresden-elektronik.de/funktechnik/products/boards/development-boards/raspbee/description/?L=1

Then I can use all of these accessories as you describe https://github.com/ebaauw/homebridge-hue here ?

After I will connect RaspBee, it will be my smart home bridge ? Or do I need something else for that ? Thanks

ebaauw commented 6 years ago

this RaspBee

That's the one. It's also available at amazon.de (for the same price, note the VAT).

Then I can use all of these accessories as you describe

Yes (except the Hue bridge link button).

After I will connect RaspBee, it will be my smart home bridge ?

Yes, it can fully replace the Hue bridge, except for upgrading the firmware of Hue devices and for the Hue entertainment stuff. Also, there's some subtle differences between the Hue and deCONZ APIs, so Hue apps might not work.

do I need something else for that

Obviously a Raspberry Pi to install it to. I'm using a 3 B on RaspBian Stretch, running both deCONZ and homebridge on the same Raspberry.

ebaauw commented 6 years ago

I am using IPv4 connection and my internet is getting IP automatically

I think your ISP provides you with a shared IPv4 address, see #326.

papko7 commented 6 years ago

this RaspBee

That's the one. It's also available at amazon.de (for the same price, note the VAT).

Then I can use all of these accessories as you describe

Yes (except the Hue bridge link button).

After I will connect RaspBee, it will be my smart home bridge ?

Yes, it can fully replace the Hue bridge, except for upgrading the firmware of Hue devices and for the Hue entertainment stuff. Also, there's some subtle differences between the Hue and deCONZ APIs, so Hue apps might not work.

do I need something else for that

Obviously a Raspberry Pi to install it to. I'm using a 3 B on RaspBian Stretch, running both deCONZ and homebridge on the same Raspberry.

Nice! I think I am gonna change my Hue bridge for this Raspbee, Thank you for all your answer, I really appreciate it