Giter VIP home page Giter VIP logo

hue-to-mqtt-gw's Introduction

hue-to-mqtt

mqtt-smarthome

Convert Philips Hue messages to mqtt messages.

Why another hue-mqtt-bridge?

  • Support for Friends of Hue switches.
  • I like to switch to zigbee2mqtt for my hue lights at some point of time. The light messages are compatible with this format.
  • Completely written using Hue API v2
  • Server-Sent Events

Docker

This application is intended to be executed using docker. Example docker compose usage:

huemqtt:
  hostname: huemqtt
  image: pharndt/hue2mqtt:2.5.1
  volumes:
    - ./config/huemqtt:/var/lib/huemqtt:ro
  restart: always 
  depends_on:
   - mosquitto

Supported devices

  • Lights
  • Philips Switches
  • Friends of Hue Switches
  • Temperature sensors
  • Presence sensors
  • Daylight sensors
  • Ambient light sensors

Example message

The message will be posted to the following topic: hue/light/room/some-light

{
    "state":"ON",
    "brightness":254,
    "color_temp":230
}

Note that unreachable lights are handled as they are turned off.

Post a message

{
    "state":"OFF"
}

to the topic hue/light/room/some-light/set to turn the light off.

Post a message

{
    "state":"ON",
    "brightness":254,
    "color_temp":230
}

to the topic hue/light/room/some-light/set to turn the light on with the given brightness and color_temp.

Color

{
    "state":"ON",
    "brightness":254,
    "color":{"x":0.3691,"y":0.3719}
}

Get sate

Post a message {"state": ""} to hue/light/room/some-light/get to get the current light state.

Switch

{
    "button":1,
    "code":1000,
    "last-updated":"2021-01-09T13:08:17Z[UTC]"
}

Example configuration

{
    "mqtt": {
        "url": "tcp://192.168.2.98:1883",
        "username": "user",
        "password": "password"
    },
    "hue": {
        "host": "192.168.2.99",
        "api-key": "api-key-here"
    },
    "names": {
        "resource-uuid": "office"
    },
    "loglevel": "debug"
}

Name mappings

for resources without an own name (like light groups) or when you like to define a custom name, you can use the names configuration.

Without a name configuration, the name will be generated from

  • the room (when available)
  • the name defined by Hue (when available)
  • the resource UUID as fallback

Bridge status

The bridge maintains two status topics:

Topic: .../bridge/state

Value Description
online The bridge is started
offline The bridge is currently not started.

Raspberry PI OS note

When you get the following message on Raspberry PI OS:

#
# Fatal error in , line 0
# unreachable code

Read this: https://blog.samcater.com/fix-workaround-rpi4-docker-libseccomp2-docker-20/ Conclusion:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC 648ACFD622F3D138
$ echo 'deb http://httpredir.debian.org/debian buster-backports main contrib non-free' | sudo tee -a /etc/apt/sources.list.d/debian-backports.list
$ sudo apt update
$ sudo apt install libseccomp2 -t buster-backports

hue-to-mqtt-gw's People

Contributors

renovate[bot] avatar philipparndt avatar renovate-bot avatar sirkingchase avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.