Creating a new device / grouping

Begonnen von andyclimb, 05 Juni 2015, 16:07:42

Vorheriges Thema - Nächstes Thema


Hello all,

I've build some lamps using the new ESP8266, that can be controlled using MQTT or HTTP, maybe even web sockets soon... although i have to learn about it. They got lots of settings, including mode (nearly 20), colour, pattern, speed, animation speed..  so I've created a dummy device for each one, and then an MQTT_BRIDGE device for each one of these, and it works but i need to create a lot of devices to do the controlling...  anyway... the point is that all these dummy devices to do the controlling take up a LOT of space in the room... which also has temp, humidity, etc etc..

What I would like is to be able to create a super device... and have these devices all nested inside as sub devices... say with the super device just presenting one thing.  Kind of how device implementations work at the moment..

Has online thought of this problem before / requested something like it / got any working solutions... 

Thought i'd share a picture of my lamp...


Here it is...
( and it animates, has UDP streaming, and hyperion/ambilight via serial (adalight) capabilities... all from an ESP8266


FHEM im Debian Container uaf QNAP, diverse Homematic Komponenten


I see the following alternatives:
- instead of a bunch of dummy devices use one dummy device with a bunch of readings.
- use readingsGroup
- build you own module :)


Thank you for the advice. 

Is there a way of having different input methods for readings within one dummy device...

i'd like a drop down box for effects. A slider for animation timer.   

I think building my own module is the way forward.  but i have no experience with this or with perl... so this might be a long road.

I'm not entirely sure what is possible using readingsGroup so i need to look into it. 



you can use webCmd to configure the slider and drop down.

have a look at readingProxy and the color lamp examples in the current fhem.cfg.demo. multiple inputs are a little easier with readingProxy than a regular dummy. there is also a dmx control example in the wiki.

readingsGroup would allow a visual grouping of different devices there are lots of examples in the wiki.

regarding space usage: readingsGroup can be collapsed and expanded if needed.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...


Ah readings proxy might help...

actually what i've done that is not too intensive is to create a load of dummies, then have a user readings that makes the command, a notify that passes the command to a dummy that is paired with a MQTT_BRIDGE.  This works well apart from 1 thing.  I have a bunch of modes... about 28 different light effects... I can pass text i the form "mode=fancy light mode 1"  or "mode=1".  fhem does not like spaces in the commands as it puts them into different event parts...


Can I have a setList that displays the text... but then sends the number... this would fix it for me! 

many thanks



that should be possible with eventMap in a normal dummy or with the setFn in readingsProxy.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...


thank you.  that works if i map say 1:xyz... but where I'm really running into trouble is with spaces...

here is what i have in the setList..

state:Off Rainbow Color Chase Rainbow,Fade,AdaLight,test,Looparound,Pick Random,Fade in Fade Out,Cool Blobs,UDP,Rainbow Cycle,Spiral,Squares2,Squares Random,Test4,Squares,EQ1,Random Colour, Random Function, Art-Net, HSV Top Bottom, Linear Top Bottom, Single Colour Fade, Random Colour Fade, HSIcycle

but every space is made into a separate item in the list.  so not quite what i want... from the commandref i thought that it is a comma separated list! 

any ideas?


now I'm confused...
This is my setlist.  i took the spaces out
This is my eventMap
Off:0 Rainbow:1 Color:2 Chase-Rainbow:3 Fade:4 AdaLight:5 test:6 Looparound:7 Pick-Random:8 Fade-in-Fade-Out:9 Cool-Blobs:10 UDP:11 Rainbow-Cycle:12 Spiral:13 Squares2:14 Squares-Random:15 Test4:16 Squares:17 EQ1:18 Random-Colour:19 Random-Function:20 Art-Net:21 HSV-Top-Bottom:22 Linear-Top-Bottom:23 Single-Colour-Fade:24 Random-Colour-Fade:25 HSIcycle:26

The results are inconsistent..
Off -> 0
Rainbow -> 1
Chase-Rainbow -> Chase-1
Fade -> 4
Adalight -> 5
Pick-Random -> 8
Fade-in-Fade-Out -> 4-in-Fade-Out

so what is going on and why do some, but not all give partial hits... (i think it is because it is matching the fade defined earlier.)  How can i stop this?


In addition to the problem above I'm struggling to get the eventmap to work. 

I'm now using readings proxy as it is a simpler way to get things working and i'm almost there.

ReadingsProxy --> MQTT_DEVICE  --> MQTT message. 

For my effects i want a bunch of descriptions for the effect... as in my post above. (red mood blobs, green mood blobs, flashing headache)  and have the map to 1 2 3 respectively.  I was the text to appear in the drop down box (which i have), but then when i select an option it sends a 1, or 2, or 3 out via MQTT.  The event map works as a reading in them, but the value sent out is still the old text.  is there a way around this.

Also it seems that EventMap ignores the - ..  so words with a dash are partially found and replace.  as in my above post.

im so close....


There is a new, more complex eventMap variant you might try.


is that the explicit variant... in attr store eventMap { dev=>{"on"=>"open"}, usr=>{"open"=>"on"} }

However, regardless.  will this one actually change what is outputted via MQTT.  The other event map does not. 


I have this as my event map,
{ dev=>{"1"=>"effect1"}, usr=>{"1"=>"effect1"} } or
{ dev=>{"1"=>"effect1"} } or
{ usr=>{"1"=>"effect1"} }

created from the example on the commandref. 

I get this as an error
syntax error at (eval 56459) line 1, near "">{"effect1" in the text box for the device.
Now I'm a bit confused...


i have not used the new format but i think you should probably use the strings that should be send in the setList and use the event map only to map these to the display values in the frontend.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...


i tried that, but the problem is you are then blindly selecting 1 and 2, without knowing what they mean.  Are you aware of a method of doing it that way round?