WebThingsIO / gateway

WebThings Gateway
http://webthings.io/gateway
Mozilla Public License 2.0
2.61k stars 333 forks source link

Allow things to be added to groups #1191

Open mrstegeman opened 6 years ago

mrstegeman commented 6 years ago

This would allow for commands like "dim the kitchen lights", which would affect all lights in the kitchen.

dstaley commented 6 years ago

I think this could be built on top of a more generic "Groups" feature that allows users to create arbitrary groupings of devices. One of my most used features in my current smart lighting controller is the ability to place lights in multiple groups. I have groups for the kitchen, dining room, living room, and bedroom. I also have a group called "Main" which contains the lights from the kitchen, dining room, and living room. This allows me to issue commands like "turn the kitchen lights on", and "turn the main lights on".

A generic grouping option would be a great foundation for automatic room-based groups.

benfrancis commented 6 years ago

An upside of "groups" vs. "rooms" is that it might cause less confusion in the floorplan view, where being positioned in the living room on the floorplan is not the same as being in a "room" called living room. If groups were more generic this might be more clear.

Groups also allows for overlapping groups, so a light could be both in the "kitchen" group, the "downstairs" group and the "indoors" group.

freaktechnik commented 6 years ago

I'd ask that this is something exposed to adapters, or maybe even to the base things. Since some things can be grouped with each other on the protocol level (for performance reasons or synchronization). And so adapters can add pre-defined groups by the user from the platform they include.

Some specific examples: Sonos speakers can be grouped, to form stereo/surround groups (which are called rooms. Every speaker, even if it's mono has a room). Rooms can then be grouped for simultaneous playback. I currently mis-use the actions system to let rooms join each other by providing a list of rooms and letting the user select what rooms to group with the current thing/room (from what I understand I'm exposing rooms as things, not individual speakers).

For pre-existing groups: I have a lot of groups in hue, most of them room groups, some of the advanced spanning control groups to turn on and off multiple related rooms. It'd be nice if the gateway's group system would just be able to know about those.

And lastly I'd like to suggest a "bounding box" style appearance of groups on the floorplan, and maybe even a creation mode where you can make bounding boxes. I realize that not all groups would contain devices inside the bounding box, but I'd suggest to just hide devices when showing groups. If you're grouping devices it's probably already pretty busy to start with ;)

zbraniecki commented 6 years ago

Hi all, I would be interested in tinkering with this concept since it's the next missing item for me in gateway. I have a blueberry pi installed and I have also built/ran gateway locally, but I haven't write any code for it yet, so I'm not sure where to start.

Can someone provide me entry barrier mentoring for how to start working on this feature?

benfrancis commented 6 years ago

This feature is still awaiting a UX specification and is not currently targeted for the next release (0.6.)

However, if you want to experiment then I would start by getting a development environment running on your desktop/laptop computer by following the instructions in the README to build the gateway software on Mac/Windows/Linux.

Then take a look at index.html, things.css and things.js for the things screen front end and things.js (model) and things_controller.js (controller) for the back end.

We will need to add the concept of groups to the back end API and figure out how they fit into the front end UI.

Feel free to discuss ideas in this issue or ask for support on Discourse or IRC :)

zbraniecki commented 5 years ago

Thanks! I don't know when I'll be able to toy with this, so please, consider this item free to grabs, I'm not claiming it. If I get to start hacking on it, I'll update the issue.

flatsiedatsie commented 5 years ago

I am running into this too.

Currently the MySensors webthing project creates a separate thing for each 'child sensor' of the devices it connects to. For example, a weather station will create a separate thing for the temperature, the humidity and the barometer value.

At first I thought it would make sense to combine these into one complex device.

But another issue here is the same issue that Domoticz has: an inability of the Mozilla Gateway interface to display things with multiple children as one device in the interface (although I was able to hack that in). The ball-shaped interface doesn't do well in displaying devices that have multiple values that are equally important, such as in this weather station case.

To solve this issue, HomeAssistant's new Lovelace UX is embracing the web components standard. Perhaps there can be some shared code and effort here.

Here's an example.

freaktechnik commented 5 years ago

@flatsiedatsie I don't think groups are the solution to your problem. There's #1383 which would allow one single property to contain multiple values, thus "nesting" those values further inside the device, similar to it being a child.

Further you can have any number of properties (though the UI does struggle at some point...) as long as they have unique names (not labels, names).

As I've commented in the issue linked on "multiple values", that is more a limitation of what the gateway currently supports in terms of devices and likely wouldn't be improved with groups at all.

Lastly, as far as I know the gateway UI also uses web components.

flatsiedatsie commented 5 years ago

@freaktechnik Thanks! I'm not as versed in the technicalities of the gateway. Do you perhaps have a picture of what this multi-property output looks like? An image search only shows simple items.

Perhaps some practical examples help, as I have some devices that have a lot of outputs. For example:

flatsiedatsie commented 5 years ago

@freaktechnik was kind enough to continue the discussion at the MySController-rs issue list. He gave this example:

https://user-images.githubusercontent.com/640949/48773844-da025380-ecc8-11e8-99d4-0af7f20667d4.png

My response: However, don't these examples require a user to click on the thing to expand it into the octopus state? The question was about showing all the data without having to click on it. At a glance.

freaktechnik commented: Ah, that is not possible. It could in theory be possible with a matching capability, but that's not something the UI currently tries to do. [...]

My response: If that's not possible, well, that's something for Mozilla to explore I think. All other controllers allow this in some form.

flatsiedatsie commented 5 years ago

Just some real world horror right now :-)

all_things

(This is what happens when properties are created as things just so that you may have the option to see all data 'at a glance' (without having to click on a Thing first).

flatsiedatsie commented 5 years ago

I've created a possible UX sketch here to get discussion going: https://github.com/mozilla-iot/gateway/issues/1383

DavidKarlas commented 5 years ago

Just a though, someone could make simple adapter that allows "merging/grouping" muliple things into 1 thing. The way this adapter would work, same as GPIO or Pulse adapter it would allow to add multiple things and inside that thing user would have to list things that want to be grouped. Then this new Thing would expose all Properties/Actions/Events... that grouped things have. Probably wouldn't take long to code this.

flatsiedatsie commented 5 years ago

I've sketched some mock-ups that relate to this here: https://github.com/mozilla-iot/gateway/issues/1597

ssendev commented 5 years ago

I had similar issues in #1814.

The way i imagined groups to work on a ui level is that they look like a thing in the thing view and clicking the details-web opens another thing view where the grouped things are displayed. Things in groups are not show in the main thing view.

In the rules view the group would be represented by its own thing so that it's possible to add rules like if group = on then light1 = on and light2 = on. Klicking the group in the main view would then turn both lights on

Arzachena commented 5 years ago

Please consider implementing groups as a thing so that we can have groups of groups as a thing. Not being able to have groups of groups is a major shortcoming of the Hue Bridge and Google Home. A light fitting with 2 bulbs needs a group, and probably needs to be in a 'room' which needs a group, which probably needs to be in the 'floor' group, etc, etc. So we build a group by adding things which represent things and/or things which represent groups. 'https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html' shows useful properties and constraints - could we do something like this? And what about Dynamic Groups (see above link) And please don't refer to groups as rooms in the UI. If the group happens to be a room it's enough to have 'room' in the name of the group.

tssk commented 4 years ago

Hello, I have some ideas about organizing things as when you have more that 10 things it starts to be quite confusing.