MQTT and RGB lights, Blinds, groups and other things

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
ptitneo
Posts: 68
Joined: Tuesday 06 December 2016 22:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

MQTT and RGB lights, Blinds, groups and other things

Post by ptitneo »

Hi there, Domoticz community!

I've been using Domoticz on a Pi for a little while now, and wanted to build a simple dashboard webpage. I was inspired by dcnoren's work in using MQTT.

The main difference is that my project won't require a node server to run. It's also entirely configured from the interface, and settings are stored locally on the browser. That makes it possible to build different layouts on different devices. Many dashboards I've seen require a rather cumbersome configuration involving file editing, idx hunting and trial & error that I'd like to avoid here. And it's also an excuse for me to build something with React ;)

I have a working prototype that's promising, but as I started implementing different controls I hit a major problem: I can't seem to find how to control anything that's not a basic switch, such as blinds and RGB lights for starters. The wiki page for MQTT doesn't mention them, nor how to control a whole Group. I ran a few searches against the main MQTT topic without much success.

For blinds (mine are Somfy and on Domoticz the control is of simple type, with just Open, Close and Stop), I can get them to open and close by sending basic "switchlight" On and Off messages. But for Stop nothing happened. After a while I came up with this:

Code: Select all

{
  command: "switchlight",
  idx: blindsDeviceId,
  switchcmd: "Set Level",
  level: 2  // anything but 0 here seems to work
}
It sort of works, but command is sent multiple times (even with QoS = 2) because the blind stops, then moves to the "My" custom position (as if pressing stop twice on a regular remote or on Domoticz dashboard).

For RGB (Hue bulbs) I found this JSON API query somewhere on the forum:

Code: Select all

/json.htm?type=command&param=setcolbrightnessvalue&idx=15&hex=FF00FF&brightness=100&iswhite=false
but I have no idea how this would translate as an MQTT message.

Lastly, I don't know how to control groups. I can read messages and retrieve their status, but I don't know how to send commands. There are some idx collisions between groups, scenes and devices in my domoticz install and I'm not sure it's normal, but it means a "swichlight" command will act on the device, not a group with the same idx.

If all else fails, I'll fallback to using the JSON API to send the missing/unsupported commands, but this feels rather inelegant.

Thanks for reading :)
Last edited by ptitneo on Thursday 22 December 2016 13:17, edited 1 time in total.
ptitneo
Posts: 68
Joined: Tuesday 06 December 2016 22:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MQTT and RGB lights, Blinds, groups and other things

Post by ptitneo »

Well, I went on and built my dashboard using a mix of MQTT and JSON when necessary. The project post is here.
JenniferRipley
Posts: 1
Joined: Tuesday 10 January 2017 10:40
Target OS: -
Domoticz version:
Contact:

Re: MQTT and RGB lights, Blinds, groups and other things

Post by JenniferRipley »

Your projects look great! I just wonder if you have tried the universe LED RGB lights used as the high power RGB LED and LED wash lights
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest