Navigation

    Discussion Forum to share and further the development of home control and automation, independent of platforms.

    SmartHome Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Unsolved
    (Last Updated: June 19, 2021)
    • Adding remotes, scene controllers as entities to MSR

      A

      EDIT: 2022.07.01

      So I will try to remake this thread to some kind of guide for future use, or in worst case a documentation of my failure. At least that could also be useful for letting someone know what didn't work...
      I have zero knowledge of programming, so every time I need to edit a config file in HomeAssistant or similar it requires a good portion of googletime and read, re-reading instructions.
      Also is english not my native language, so bear with me.

      Two goals!
      1: Get MSR to take notice (and then actions of course) of pressed buttons on remotes.
      2: Document what I do in hope I can help someone else in the future.

      I will use a Fibaro Keyfob as described below, but what I understand from Togglebits answers most type of remotes should work in similar ways.

      Original thread:
      Fibaro Keyfob support in MSR? (thru Hassio & Z-wave JS)
      Hi

      I just bought a Fibaro Keyfob FGKF-601 and plan to give this to my son so he can control some stuff in his own room. Primary some lightning and Sonos, maybe blinds in the future.

      As the noob I am it will, of course, not work as I expected.👶🏻

      The remote handle 1x, 2x, 3x clicks per button (six of them) and "release button"
      I thought that it would appear like some "scene controller" in HA and that I could make Rules in MSR depending on what scene-entety that was triggered.
      So is not the case, and if that is because of HA, Z-wave JS or MSR I have no idea.
      I found a HA Blueprint that works in HA, but of course I would prefer to keep all automation in MSR.
      I guess a workaround could be using HA virtual switches "Helpers" that I suppose will come up as an on/off trigger in MSR, but before going this way I would like to check with the wisdom of your guys if there is a better way of doing this.

      I am using:
      MSR 22168 on windows.
      Home Assistant Core 2022.6.7
      Home Assistant Supervisor 2022.05.3
      Home Assistant OS 7.6
      Z-Wave JS version: 0.1.64

      Multi-System Reactor
    • Constraints under triggers or under constraints, what is the difference?

      A

      Need to ask, have thougth about this since the move from Rector to MSR I think.

      What is the difference between putting constraints under trigger groups, like this
      23b4a249-3292-41cd-9927-7f49c9bf1d07-image.png

      Compared to this similar rule, but the time limits is under contraints instead?
      ee596c9f-f52b-4a39-9605-f5932f3d9ed5-image.png

      I think the Constraints parts in manual is still to be done because I can only find in the chapter menu, but it is not mentioned anywhere else.

      Multi-System Reactor
    • The Home Remote with MSR

      MikeReadington

      Did anyone do/start any work on a full integration with The Home Remote application yet?

      Multi-System Reactor
    • Condition must occur after -restriction not working

      tunnus

      Running MSR 22123 in Docker container and trying to use "condition must occur after" option. Will update to the latest build and log a PR if needed, but wanted to poll first if anyone is using this option successfully?

      I have the following rules:

      Screenshot 2022-06-28 at 15.18.50.png

      Notification activity connected to "Alarm disabled" rule did not trigger. I also did another test with quite simple rules and that didn't work either (FWIIW - when observing that test in "real-time", I didn't see any timer running on the second rule while the first rule was true).

      As said, before going further with debug/logs, nice to know if someone is using this option/restriction (successfully).

      Multi-System Reactor
    • Reactor (Multi-System/Multi-Hub) Announcements

      toggledbits

      Build 21228 has been released. Docker images available from DockerHub as usual, and bare-metal packages here.

      Home Assistant up to version 2021.8.6 supported; the online version of the manual will now state the current supported versions; Fix an error in OWMWeatherController that could cause it to stop updating; Unify the approach to entity filtering on all hub interface classes (controllers); this works for device entities only; it may be extended to other entities later; Improve error detail in messages for EzloController during auth phase; Add isRuleSet() and isRuleEnabled() functions to expressions extensions; Implement set action for lock and passage capabilities (makes them more easily scriptable in some cases); Fix a place in the UI where 24-hour time was not being displayed.
      Multi-System Reactor
    • [Solved] Changes in 22178 for HASS sensor no longer provide a value in topic "value", MQTTController echo capability

      Crille

      Before updating to 22178 there was a primary value echoed in MQTTControllers echo capability, can I tell the controller which value to put as primary from HASS sensors after this change as it now is null? or is it a bug?

      I have not changed the

      primary_attributes: true

      mqtt_value.PNG

      Reactor latest-22178 bare metal
      Hass 2022.6.7

      Edit: Solved in build 22179

      Multi-System Reactor
    • Using InfluxDB with MSR

      wmarcolin

      Hi!

      I have a system that I consider pretty stable, running in a VM Ubuntu 20.04, it has some communication failures, but I think more by HE than by the OS/MSR.

      I'm thinking of taking the next step to get more advantages from the system, and I'm thinking of using InfluxDB maybe for queries or to extend rules.

      The question is, I would like practical examples of what really helps to install InfluxDB? What would you be doing that really makes a difference with this installation? Can you post examples of features or information?

      Thanks

      Multi-System Reactor
    • git hub docker container not available?

      Black Cat

      @toggledbits - what now?

      Re: Cheapest platform on which to run MSR

      21aaf68e-c031-414d-847d-d8bec01d57e7-Clipboard01.jpg

      Multi-System Reactor
    • Synology NAS docker image replacement

      MikeReadington

      Hi Everyone,

      MSR had a docker image file naming convention change, and I am not exactly sure how to swap the image out. I'm sure it's not rocket science, I've just never done this before.

      I am using a Synology NAS, and under the environment tab there is a "REACTOR_IMAGE" variable. Can I just change the image name to the new image naming convention and clear the container, or should I launch a new container and populate the volume location from the previous reactor?

      Thanks in advance

      Multi-System Reactor
    • Cheapest platform on which to run MSR

      T

      Please can anyone give me advice on a cheap way to run MSR (both initial cost and ongoing electricity cost). I currently run it on my QNAP network drive (which works very well incidentally). However, this draws a constant 35Watts (£90/yr @ 30p/kWh) and given the recent rise in fuel costs I am evaluating the best way forwards. Note, I only really need to turn my QNAP on for an hour a week to back-up my computer data. I understand that MSR can run on a Raspberry PI, but I am not competent with Linux! Thanks.

      Multi-System Reactor
    • Copying configuraiton and rules from QNAP install to Raspberry PI 4 install

      T

      I have made good progress setting up a new Raspberry PI 4 with the latest OS (64bit) and latest Reactor images in Docker. However I am not able to copy my configuraiton files (.yml) and reactor reactions over. I am not yet that confident with linux commands, so I have tired to drag and drop the files from a USB drive to the working folders in my new Raspberry PI. I am getting a popup in the GUI stating 'The file operation was completed with errors.' and Errors occured: "rule-xxxxxx.json: Error opening file "/home/pi/reactor/....................................json":Permission denied.

      I suspect it's something to do with permissions?

      Is there an easier way to copy my configuration over??

      Multi-System Reactor
    • Alexa TTS via Home Assistant?

      T

      Hello All -

      I'm gradually moving away from Vera to Home Assistant. I've recently gotten the Alexa and Mini Media Player setup in Home Assistant and everything is working well.

      Is there a way to call this service from Reactor? My goal is to send TTS requests to HAAS upon certain events within Reactor (e.g. "Front Door Opened")

      Multi-System Reactor
    • Integrate UPS with MSR

      wmarcolin

      I have a Tripp-Lite UPS (https://www.tripplite.com/smartpro-lcd-120v-1500va-900w-line-interactive-ups-avr-tower-lcd-usb-10-outlets~smart1500lcdt) that connected by a USB cable to my computer, reports various power supply and failure information, as shown in the panel below.

      b9f0ea34-d654-4b26-b968-4f8cf0a4e0c1-image.png

      afa73913-5318-42c6-af9a-02d36e2e6ea1-image.png

      The application I installed runs Java and opens the console to send the information.

      Has anyone tried to bring the information into the MSR? Or even a VeraPlus?

      Thanks.

      Multi-System Reactor
    • Reactor as tab in Hass sidebar

      Matohl

      panel_iframe in configuration.yaml. If you access MSR with HTTP it works in HA with HTTP to Reactor and HTTPS to HTTPS obviously.

      configuration.yaml

      # ============ SIDEBAR ============ panel_iframe: reactor: title: "Reactor" url: "http://192.168.0.23:8111/reactor/sv-SE/"
      Multi-System Reactor
    • Documentation>Network Status

      S

      It appears that in the Manual, under Management>Network Status is for Reactor on Vera. Is the Internet check functionality available with MSR and if so is there updated instructions? I do see a variable reactor_system.internet.ok but the value is null.
      I am looking for a way to check for internet status with MSR before installing an extra app on a hub to get the information.

      Synology Docker latest-22149

      Multi-System Reactor
    • MSR Upgrade from 22119 to 22136 fails, service wont start

      W

      Windows Server 2022 Build 20348
      Nodejs v16.14.0
      Currently running Reactor (Multi-hub) stable-22119-ae7212f
      Linked to Hass 2022.0.5.4 (on a different box)
      Windows server is dedicated to MSR and doesn't do anything else.

      I'd like to upgrade to 22136 to take advantage of the SSL feature added recently, and also to bring my current version of Hass into the 'supported' column with MSR.

      Following the instructions here: link text, section "Upgrade Windows Bare Metal"

      Stop Reactor Service Extract the zip, overwriting the reactor folder in c:\reactor\reactor There is no package-lock.json file so I skip that. Run "npm install --no-save --omit dev"

      Next step is to start the service. I start the service and it immediately stops. "Windows could not start the Reactor service on Local Computer. Error 1067: The process terminated unexpectedly".

      Tried rebooting, service won't stay running.

      I suspect I'm missing something, it's probably obvious but I've not been able to figure it out.

      I rolled back the reactor folder version (Windows Shadow copies) and then the service starts fine.

      Anyone else running Windows and know what I'm missing?

      Tail of log file from running OK version, before upgrade attempt [stable-22119]2022-06-01T22:20:19.081Z <Rule:INFO> Lounge Billy Ambient Lighting - Turn On (Rule#rule-l0ki453b) evaluation complete [stable-22119]2022-06-01T22:20:19.082Z <httpapi:NOTICE> HTTP API v1 22021 base URL http://172.16.128.6:8111; listening [stable-22119]2022-06-01T22:20:19.228Z <app:NOTICE> HTTP server running; registering proxy endpoints. [stable-22119]2022-06-01T22:20:19.228Z <app:NOTICE> Starting WSAPI... [stable-22119]2022-06-01T22:20:19.229Z <wsapi:NOTICE> wsapi: starting version 21334 [stable-22119]2022-06-01T22:20:19.656Z <Engine:INFO> [Engine]Engine#1 master timer tick, local time "6/2/2022, 8:20:19 AM" (TZ offset 600 mins from UTC) [stable-22119]2022-06-01T22:27:54.788Z <wsapi:INFO> wsapi: connection from ::ffff:172.16.128.5 Tail of log file from failed to start after upgrade (is identical, ii.e. nothing has been appended to it) [stable-22119]2022-06-01T22:20:19.081Z <Rule:INFO> Lounge Billy Ambient Lighting - Turn On (Rule#rule-l0ki453b) evaluation complete [stable-22119]2022-06-01T22:20:19.082Z <httpapi:NOTICE> HTTP API v1 22021 base URL http://172.16.128.6:8111; listening [stable-22119]2022-06-01T22:20:19.228Z <app:NOTICE> HTTP server running; registering proxy endpoints. [stable-22119]2022-06-01T22:20:19.228Z <app:NOTICE> Starting WSAPI... [stable-22119]2022-06-01T22:20:19.229Z <wsapi:NOTICE> wsapi: starting version 21334 [stable-22119]2022-06-01T22:20:19.656Z <Engine:INFO> [Engine]Engine#1 master timer tick, local time "6/2/2022, 8:20:19 AM" (TZ offset 600 mins from UTC) [stable-22119]2022-06-01T22:27:54.788Z <wsapi:INFO> wsapi: connection from ::ffff:172.16.128.5 reactor.wrapper.log (log file the failed to start event points to) 2022-06-02 08:19:23 - Stopping reactor.exe 2022-06-02 08:19:23 - ProcessKill 3628 2022-06-02 08:19:25 - Shutdown exception Message:A system shutdown is in progress. Stacktrace: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Management.ManagementScope.InitializeGuts(Object o) at System.Management.ManagementScope.Initialize() at System.Management.ManagementObjectSearcher.Initialize() at System.Management.ManagementObjectSearcher.Get() at winsw.WrapperService.GetChildPids(Int32 pid) at winsw.WrapperService.StopProcessAndChildren(Int32 pid) at winsw.WrapperService.StopIt() at winsw.WrapperService.OnShutdown() 2022-06-02 08:20:11 - Starting C:\Program Files\nodejs\node.exe C:\reactor\reactor\node_modules\node-windows\lib\wrapper.js --file C:\reactor\reactor\app.js --scriptoptions= --log "Reactor wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst undefined 2022-06-02 08:20:11 - Started 3272 2022-06-02 08:30:54 - Stopping reactor.exe 2022-06-02 08:30:54 - ProcessKill 3272 2022-06-02 08:30:54 - Found child process: 3280 Name: conhost.exe 2022-06-02 08:30:54 - Found child process: 3504 Name: node.exe 2022-06-02 08:30:54 - Stopping process 3280 2022-06-02 08:30:54 - Send SIGINT 3280 2022-06-02 08:30:54 - SIGINT to 3280 failed - Killing as fallback 2022-06-02 08:30:54 - Stopping process 3504 2022-06-02 08:30:54 - Send SIGINT 3504 2022-06-02 08:30:54 - SIGINT to 3504 failed - Killing as fallback 2022-06-02 08:30:54 - Stopping process 3272 2022-06-02 08:30:54 - Send SIGINT 3272 2022-06-02 08:30:54 - SIGINT to 3272 failed - Killing as fallback 2022-06-02 08:30:54 - Finished reactor.exe 2022-06-02 08:33:41 - Starting C:\Program Files\nodejs\node.exe C:\reactor\reactor\node_modules\node-windows\lib\wrapper.js --file C:\reactor\reactor\app.js --scriptoptions= --log "Reactor wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst undefined 2022-06-02 08:33:41 - Started 4184 2022-06-02 08:36:57 - Starting C:\Program Files\nodejs\node.exe C:\reactor\reactor\node_modules\node-windows\lib\wrapper.js --file C:\reactor\reactor\app.js --scriptoptions= --log "Reactor wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst undefined 2022-06-02 08:36:57 - Started 3100 Windows event log event: Child process [4184 - C:\Program Files\nodejs\node.exe C:\reactor\reactor\node_modules\node-windows\lib\wrapper.js --file C:\reactor\reactor\app.js --scriptoptions= --log "Reactor wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst undefined] finished with 1
      Multi-System Reactor
    • [Solved] suninfo.period "night" and rule trigger for sunset are at different times

      Crille

      I'm just curious, what's the difference between suninfo.period changing from "day" to "night" vs "after sunset" with no offset?
      suninfo.period changes to "night" 7 minutes and 33 seconds before "after sunset" is triggered in my latest-22149 bare metal setup.

      Multi-System Reactor
    • Status page rule history length.

      MikeReadington

      Hello Patrick,

      On the status page rule history is there any adjustably on length of the history shown? I had an occasion where it would have been helpful to go a few notches farther back than it does as currently configured.

      I don't know if this is a log parser or if it is a separate smaller data set. If it is a log parser, any chance for maybe something like a "more" button?

      Thanks,
      Mike

      Multi-System Reactor
    • [Solved] New device on Ezlo is not added in Reactor

      Crille

      I can't find any posts or reference in docs for this log message

      <EzloController:NOTICE> EzloController#ezlo received notice of new device, but auto-rediscover is OFF; ignoring

      I've restarted MSR and hard refreshed browser but the new entity is not added. Can I set auto-rediscover to ON or how do I get the new device added into Reactor?

      Edit:
      Bare metal latest-22142
      The device is a Xiaomi Mini Switch, it's publishing correct values in ezmqtt.

      Edit 2: The Xiaomi Aqara Mini Switch is now mapped in build 22149.

      Multi-System Reactor
    • Disk Warning on Multisystem Reactor

      S

      334ccd7a-9499-4dea-8a4a-2347609dce62-image.png

      For the life of me I cannot figure this out.
      when I run the du -hs command (from the host) for the mapped volume I get 25M
      (/home/seth/ReactorConfig maps to /var/reactor)

      Inside the container I ran du -hs for each of the folders that the ui is complaining about
      /opt/reactor = 71.2M
      /var/reactor/storage = 2.9M
      /var/reactor/logs = 17.6M

      If I run df on the docker container I get this. Disk space is not critical
      1f5d230c-0792-468b-b3b7-9f45e31581c5-image.png

      What gives?

      Multi-System Reactor
    For those who registered but didn't received the confirmation email, please send an email to support@smarthome.community with the email you used

    Expression to randomly run Global Reactions ?

    Multi-System Reactor
    4
    39
    260
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cw-kid
      cw-kid last edited by cw-kid

      Hi

      I had an MSR rule to run some LUA code that would randomly run different Vera scenes to change the colours on some garden lights, the rule would pulse every 15 minutes, so a different Vera scene was selected to change to a different colour etc.

      local scenes = {"172", "173", "174", "175", "176", "271", "272"}
      local tmp_random_number = math.random(1,7)
      local  scene_id_to_launch = scenes[tmp_random_number]
      luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = scene_id_to_launch}, 0)
      

      This was working OK, but then I have been deleting lots of scenes off my Vera Plus and making them MSR Global Reactions instead and I forgot about this setup and now its broken as the Vera scenes have gone.

      So now I have several MSR Global Reactions for setting each colour on these garden lights. But don't know how to achieve the same thing but by using Global Reactions instead of Vera scenes.

      fe50d423-137d-438a-a090-d3cd709270be-image.png

      Anyone good with expressions ? Or another way to do this in a rule?

      Thanks

      1 Reply Last reply Reply Quote 0
      • LibraSun
        LibraSun last edited by

        How about having an MSR rule run at regular intervals, which would then pick a whole number between 1 and 7, and run other rules (or just do the things itself) based on the chosen number?

        If I were to lay that out, it would go something like this (in pseudocode, not actual scripting in MSR):

        Rule: RUN EVERY 15 MINUTES
        Expressions: choose = floor(random()*7+0.5)
        Triggers: Condition = Interval every 15:00 relative to midnight
        Constraints: (none)
        Set Reaction:
        [group] [expression value] [choose] [==] [1]
        [entity action] ► do the colors for scene #1
        [group] [expression value] [choose] [==] [2]
        [entity action] ► do the colors for scene #2
        [group] [expression value] [choose] [==] [3]
        [entity action] ► do the colors for scene #3
        etc.

        Reset Reaction: <empty>

        1 Reply Last reply Reply Quote 1
        • cw-kid
          cw-kid last edited by

          Hi LibraSun

          Something like that may work. I actually have a virtual switch in Vera and my previous rule was triggered when that virtual switch was turned on, it would then run the LUA code that in turn picked a random colour scene in Vera.

          It would retrigger every 15 minutes and then run the LUA code again and pick another colour scene.

          And if I turned off the virtual switch in Vera it stopped doing it and the lights were turned off etc.

          1 Reply Last reply Reply Quote 0
          • LibraSun
            LibraSun last edited by

            In that case you could definitely include the virtual switch as one of the trigger conditions. That way when the switch is off the rule won't continue running every 15 minutes.

            Also since you are not afraid of expressions, you could easily use them to create the random colors as well and use those expressions in Lua code with ${{ }} substitution.

            cw-kid 1 Reply Last reply Reply Quote 0
            • cw-kid
              cw-kid @LibraSun last edited by cw-kid

              @librasun

              What makes the expression run and generate a new number after a period of time?

              This is what I have so far.

              Trigger is the virtual switch in Vera.
              Pulse every 1 seconds and repeat every 60 seconds.

              40a55606-5dd6-4434-8131-03320411fb36-image.png

              Set Reaction - Groups that look at the expression named "ChooseColour" and its current number value and then runs a Global Reaction now directly sets that colour on the LED strip.

              c928ebf7-c1cf-4400-9230-0c3d15953375-image.png

              The random number generator expression named "ChooseColour" this is a rule expression not a Global Expression.

              b1a6ba74-2a13-40bc-b9f3-5cdebc0be840-image.png

              I added an 1 minute interval to the triggers and the virtual switch is true trigger is also pulsing every minute.

              The expression is now changing numbers every minute, but the reactions don't seem to be running as the colour is stuck and not changing.

              Also I think this expression generates the number zero which I don't have assigned to any reaction.

              LibraSun 1 Reply Last reply Reply Quote 0
              • LibraSun
                LibraSun last edited by

                You can avoid the 0 value problem by making your expression look like:

                floor(random()*6+0.5)+1 
                

                // should produce integers from 1 through 7 inclusive.

                From your description, I think you have more than just one Triggers condition pulsing. Stick with pulsing just the device_695 is TRUE condition for 1 second, repeating every 60 seconds. I don't think you need any other conditions in Triggers.

                And looking at everything you've shown us, it seems like it SHOULD be working at this point. If not, the reason is not obvious to me. You may have to poke around in the REACTOR.LOG to see what's happening (or isn't) and when. Make sure all your Rules are Enabled!

                1 Reply Last reply Reply Quote 0
                • toggledbits
                  toggledbits last edited by

                  ANDing a pulse output with an Interval is not going to work as expected. You are trying, in effect, to synchronize two asynchronous events. You'll never get it. Remove the Interval condition. The pulse serves the purpose on its own that you're trying to get the Interval to perform.

                  Author of Multi-system Reactor and Reactor, DelayLight, Switchboard, and about a dozen other plugins that run on Vera and openLuup.

                  1 Reply Last reply Reply Quote 0
                  • cw-kid
                    cw-kid last edited by

                    @toggledbits @LibraSun

                    Thanks guys. OK I have removed the interval and just have the trigger that the virtual switch must be true and I have a pulse for 1 second and to repeat every 60 seconds, just for testing, I'll set this to a longer time later.

                    I have also updated the expression with the new one to get rid of 0.

                    I have also changed the Reactions to directly set the colours of the light rather than calling the Global Reactions to do it.

                    It seems to be working, however there seem to be something strange going on with pulses and repeats ?

                    When the break count reaches zero the random number in the expression is changing quickly through 3 different numbers, which is weird.

                    Also if you set the pulse to say 15 seconds and the repeat to 60 seconds it's not behaving as I would expect ?

                    In this case when the break counter reaches zero the expression number changes to a different number, it then changes to a pulse counter for 15 seconds and when that reaches zero the expression number changes again.

                    I only expected it to change the expression number when the repeat count down from 60 seconds reaches zero not also when the pulse counter reaches zero.

                    Is this a bug or am I not understanding things correctly?

                    Thanks

                    1 Reply Last reply Reply Quote 0
                    • toggledbits
                      toggledbits last edited by

                      Each change in the edge of the pulse necessarily causes a re-evaluation of the rule because the condition state may change, which in turn may change the state of the parent groups/containers. So the sequence of what you will see is: pulse true -> reevaluation -> rule set -> pulse delay -> pulse false/break start -> reevaluation -> rule reset -> break delay -> break end/pulse true -> reevaluation -> rule set ... etc...

                      Since your actions only run when the rule sets, you still only get one set per pulse; the change in the random value has no effect in any other evaluation.

                      Author of Multi-system Reactor and Reactor, DelayLight, Switchboard, and about a dozen other plugins that run on Vera and openLuup.

                      1 Reply Last reply Reply Quote 0
                      • LibraSun
                        LibraSun last edited by

                        ...and I believe the only way to alter that arrangement (not that there's anything WRONG with how it's currently operating!), would be to affirmatively evaluate the random number using an expression tucked into the first step of your Set Reaction:

                        [Set Variable] [chooseColor] [ ${{ floor ( random ( ) * 6 + 0.5 ) + 1 }} ]
                        

                        Of course, for this setup to work, your chooseColor expression would have to be blank (otherwise, assignment doesn't work). I'm 99% confident that assigning the variable value at the outset of Set Reaction would indeed get it there in time for the subsequent case-by-case Group Constraints to utilize it as desired, but honestly I have not tested such a scenario. Worth trying, if your OCD doesn't like all those "extra" random values happening, LOL!

                        1 Reply Last reply Reply Quote 0
                        • toggledbits
                          toggledbits last edited by toggledbits

                          This is also correct (a Set Variable can be used, and will evaluate/set before the groups -- in order shown, basically). In fact, this is the way I would do it for myself, for the very reason @LibraSun recommends: it stabilizes the value, and would do so in circumstances where the usage is more complex and the debugging would be made more difficult by the rapid changes otherwise.

                          EDIT/NOTA BENE: A bit of a trap here was discovered later. Be sure to read this later post. The recommended action for this purpose/implementation is to not use a Set Variable action to choose a random value. The linked post explains why.

                          Not that it much matters, but the random expression can also just be written as floor( random() * 6 + 1 ) (ever so slightly optimized).

                          Author of Multi-system Reactor and Reactor, DelayLight, Switchboard, and about a dozen other plugins that run on Vera and openLuup.

                          cw-kid 1 Reply Last reply Reply Quote 1
                          • cw-kid
                            cw-kid @toggledbits last edited by cw-kid

                            @toggledbits @LibraSun

                            Thanks for the further suggestions.

                            I have made the "ChooseColour" expression empty and at the top of the Set Reactions I now have this:

                            af827001-5b6c-4b19-8c9f-eac7128d7150-image.png

                            The random number now only changes the once upon each repeat count down and the rule summary card now looks like this:

                            fd720374-8147-4230-81ad-a11a1ff935df-image.png

                            Its working but not reliably as the colour does not change on the light after every repeat count down. Sometimes it just stays on the previous colour that it was.

                            I have checked each Group Constraint action for each of the different colours and when pressing the Play button on each of them the LED strip does change to that correct colour.

                            And at other times the light seems to get stuck on one colour for a long time and many cycles, even though the rule is still generating numbers and then after a while it starts changing colours again, so it seems laggy.

                            Here is an example of how each Group Constraint looks:

                            cf18f604-c615-4bbb-8cdc-9f657ae17d20-image.png

                            1 Reply Last reply Reply Quote 0
                            • LibraSun
                              LibraSun last edited by

                              As of this stage, there's nothing to prevent the same color from repeating 2, 3, ... infinite times. Such is the nature of random numbers. Was it one of your prerequisites that the color always change from what it was the previous cycle? Of course, that could occasionally lead to a ping-pong of red, green, red, green, red, green, .... which you may also find objectionable.

                              1 Reply Last reply Reply Quote 0
                              • toggledbits
                                toggledbits last edited by

                                Also turn off the "Force re-evaluation of expressions" checkbox. You don't need that in this circumstance (since the use of the variable comes after the set explicitly), and it may even get in the way.

                                Author of Multi-system Reactor and Reactor, DelayLight, Switchboard, and about a dozen other plugins that run on Vera and openLuup.

                                1 Reply Last reply Reply Quote 1
                                • toggledbits
                                  toggledbits last edited by toggledbits

                                  OK... wait up... apology here. Since conditions in reactions are a new feature, even I am not completely steeped in their particular behaviors, and limitations, and I just had a "but wait..." moment.

                                  All conditions are evaluated at the same time. The group constraints are evaluated at the same time as the triggers. So, while the reaction's groups will run in sequence, the constraint result is determined before the reaction is run, and therefore doing the Set Variable action in the reaction has no effect on the then-current run of the reaction. That is, even though the reaction may Set Variable to a new random number, the constraints have already been evaluated using the previous value of the variable (what is was before the Set Variable action). So this would definitely account for the "lag" that @cw-kid is observing, because the value set by Set Variable on one run of the set reaction won't be used until the next time the set reaction runs.

                                  And it's still the case that random numbers are not guaranteed to repeat or even be uniformly distributed over a small (less than several million, perhaps?) sample

                                  So... setting your random number in the "Expressions" section of the rule, rather than by using a Set Variable action, is probably a better implementation for this purpose (at least, will be easier to follow/debug).

                                  Author of Multi-system Reactor and Reactor, DelayLight, Switchboard, and about a dozen other plugins that run on Vera and openLuup.

                                  1 Reply Last reply Reply Quote 2
                                  • LibraSun
                                    LibraSun last edited by

                                    Glad you explained all that, because I had a sneaking suspicion that the timing (and not just the order) of the [Set Variable] was important here. Kinda hard sometimes to keep it all straight, insofar as the human is not the most "logic"-al of engines!

                                    1 Reply Last reply Reply Quote 0
                                    • cw-kid
                                      cw-kid last edited by cw-kid

                                      OK understood I will change the expression back to how it was and remove the set variable in the set reaction area.

                                      I will increase the trigger repeat to 5 minutes and test it one evening when its dark outside.

                                      Ideally I'd like for a different colour each time to be selected, but I guess the expression for the random numbers could select the same number again and therefore the colour would not change for that cycle.

                                      Elcid 1 Reply Last reply Reply Quote 0
                                      • LibraSun
                                        LibraSun last edited by

                                        Alternatively, you could randomize the color selection itself (not just limited to the 4-5 RGB choices you have now). More variety at the expense of slightly more complicated MSR expressions... but with a net savings in the number of Group Constraints required (just one instead of N for N colors).

                                        cw-kid 1 Reply Last reply Reply Quote 0
                                        • cw-kid
                                          cw-kid @LibraSun last edited by cw-kid

                                          @librasun

                                          Sounds great but I don't know how to do it LOL.

                                          As is I have 7 predefined colours which are the primary hex codes for those colours, red, green, blue, purple, orange, pink, yellow.

                                          1 Reply Last reply Reply Quote 0
                                          • LibraSun
                                            LibraSun last edited by

                                            You've got me curious now: What make/model of garden lights do you have? And what is their ultimate color palette? Have you tried setting them to intermediate colors using the [Set_Color_RGB] action in MSR, for instance?

                                            cw-kid 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Welcome. If you’d like to participate in the discussion, rather than just read, then you can join the forum. As a member, you can interact with others here to share your experience and ask the questions you need answered.

                                            Powered by NodeBB | Contributors
                                            Hosted freely by PointPub Media Communications Inc. | Contact us