I don’t use Dimmers so I don’t really know if the following has any chance of working.
I think you will need to create a proxy Item (i.e. an Item that is not bound to anything) that is a Dimmer. Put this Dimmer on your sitemap using a Slider. Create a rule when this Dimmer receives a command and based on the command received send the message to your controller.
You may be able to do this in the Item itself with a Mapping or something but I don’t have any experience with Dimmers so can’t say for sure.
A Dimmer is also a Switch so you can send it ON and OFF and it will go to 100 and 0 respectively. You can put it on your sitemap as a Switch. You can also add “switchSupport” to the end of your entry on the sitemap and a single click on the up side will send ON and a single click on the down side will send an OFF.
Anybody have rule for checking state of battery operated devices…?
i want to know state of battery operated devices like fibaro motion sensors… if battery is removed.
There is no solution. This is just the way OH works.
It is a bit of a hack but if you have persistence on the Items in the Group you can:
val mostRecent = gMyGrouo.members.sortBy[lastUpdate].last
Depending on the speed of your database you may need to add a Thread::sleep(100) before that line to give persistence a chance to process the most recent event.
I thought so. That is why I asked the 2nd part of my question.
I know your recommendation (lastUpdate) from your previous posts. Works perfect.
I was wondering whether there are additional variables / information I can get in a “receive update” rule. Like I can access the receivedCommand in a “received command” rule.
Do you know where in the sources, documentation or somewhere else I can look this up. Maybe I can dig in a little bit further.
I’ve not looked at the code myself. There was a thread awhile back where someone coded something for OH 1. I don’t think it ever made it into a pull request.
If you are serious about coding something I would head over to the ESH forum as I think anything you code will be implemented there.
But beyond the lastUpdate hack there is no way to determine the triggering item.
@rlkoshak: I understand. I am not yet firm enough to provide any real coding help. As of now I am just interested in the code to find undocumented features/options.
I have another question to your last suggestion:
Since I am now using multiple persistence services (thanks to one of your previous posts), which works fine e.g. for .previousState(true,“rdd4j”). I can not figure out how to set the persistence service if it is not the default one for
gMyGroup.members.sortBy[lastUpdate,"rdd4j"] is not working
@Spaceman_Spiff: is it possible to combine existing *.rules files with jsr223 scripts? I am really curious to test an alternative scripting but I already have some quite complex rules which I do not really want (yet) to rewrite. Also as of now the script engine is not (yet) compatible with OH2. Which of course I want to try once it is officially released (out of beta).
Of course this is just my opinion. I was really struggling, switched to jsr223 + jython and now everything is super easy for me.
As for OH2:
I did ask for an update in the thread, but did not get a response yet.
As far as I know it should be implemented and there are corresponding tickets in the ESH.