Creating a new device / grouping

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

Vorheriges Thema - Nächstes Thema


I've got another question, for SUPERSTAR bonus points!!!!!! 

All this is to control some lamps that I've made using an ESP8266, and WS2812 LEDs.  They look awesome!  I've not got on/off, brightness, and speed control....  BUT...  These lamps have modes or effects.... I've basically decided that each mode will have to be one word, as fhem really does not like spaces... However, having to type out the list every time, especially as there is a lot of change... is a pain..  i have 3 lights already. 

What I would like to do is have my device, publish a list of effects that it has to say device/effectslist "a,b,c,d" and then have fhem pick that up, and use it as the list of options for the readings proxy lamp3:effect.  Is this possible...? would be absolutely amazing...  I'm suspecting getList attribute, but i've tried a few things and get nothing to work

plus.. is there a way to list a URL there? (OK scratch that, figured it out... )  ValveFn = {"<a href='http://$value' target="_blank">$VALUE</a>"}


of course this is possible...

there is not really a problem with spaces but a space means that you have a command with one or more additional parameter(s).

if you have an automated way to get the list of effects you can set the setList from your code. how to do this depends on the source of this list. i don't know mqtt but if the push results in an fhem event you can just set the setList from a notify.

you can also set an attribute for multiple devices at the same time.attr myLamp.* setList ...see devspec in the commanders for all possible ways to do this.

getList and getFn ist for get commands. like setList and setFn is for set commands.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...


ah of course, I did not think of a notify!   8)

so...  that works like a charm.  here is what I have... and this works. 

mqtt_lamp3:effectlist.* attr mqtt_lamp3_proxy_effect setList $EVTPART1

Is there a way to write a notify for a specific device type...  and a Reading then pass this on to a readingsProxy for that device..  here is my example so far

TYPE=MQTT_DEVICE:effectlist.* attr mqtt_$NAME_proxy_effect setList $EVTPART1

but this does not work.


devspec works by first selecting a group of devices by regex and then appending :FILTER=... reduce the regex result by filtering out some devices

to set the attr it should be something like this:attr .*effectlist.*:FILTER=TYPE=MQTT_DEVICE setList xxx

to use $name you have to switch to the perl level and use something like this:{fhem("attr .*effectlist.*:FILTER=TYPE=MQTT_DEVICE mqtt_${name}_proxy_effect setList $EVTPART1")}
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...


mmm, not having much luck with that.. These are the REGEXP for a notify....

.*effectlist.* set lamp on  this works, and turns the lamp on. 
.*effectlist.*:FILTER=TYPE=MQTT_DEVICE set lamp on This does not work, so the filter is not working 


.*effectlist.*  {fhem("attr ${name}_proxy_effect setList $EVTPART1")} This code picks up the change in effect list, in the device mqtt_lamp3 as above.. but fails to set the attribute to device mqtt_lamp_proxy_effect?