-
I decided to move my MSR pi to a permanent place and after that i cant connect to it. I can se in the logs that it has connection with hubitat ..
I says
2021-04-22T20:11:54.649Z Controller:ERR SystemController#reactor_system disk usage not available: Error: Cannot find module 'diskusage-ngWhat has happened? I did a hard remove by powercable....
/MattiasFull log
2021-04-22T20:10:56.493Z Controller:NOTICE Controller HubitatController#hubitat is now online.
/home/pi/reactor/server/lib/SystemController.js
2021-04-22T20:10:56.497Z app:NOTICE Starting Reaction Engine...
2021-04-22T20:10:56.498Z Engine:INFO Reaction Engine starting
2021-04-22T20:10:56.499Z Engine:INFO Checking rule sets...
2021-04-22T20:10:56.514Z Engine:INFO Checking rules...
2021-04-22T20:10:56.559Z default:ERR [IndividualFileStrategy#/home/pi/reactor/storage] failed to read cs-rule-knbyvokt in /home/pi/reactor/storage/states/cs-rule-knbyvokt.json: SyntaxError: Unexpected end of JSON input
Trapped unhandled Promise rejection SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IndividualFileStrategy.getDataObject (/home/pi/reactor/server/lib/IndividualFileStrategy.js:126:38)
at Container.getDataObject (/home/pi/reactor/server/lib/Container.js:91:53)
at Rule.getRuleStates (/home/pi/reactor/server/lib/Rule.js:601:98)
at Rule.getConditionState (/home/pi/reactor/server/lib/Rule.js:626:46)
at new Rule (/home/pi/reactor/server/lib/Rule.js:491:47)
at Function.getInstance (/home/pi/reactor/server/lib/Rule.js:500:36)
at /home/pi/reactor/server/lib/Engine.js:584:50
at Array.forEach (<anonymous>)
at Engine.checkData (/home/pi/reactor/server/lib/Engine.js:582:36)
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IndividualFileStrategy.getDataObject (/home/pi/reactor/server/lib/IndividualFileStrategy.js:126:38)
at Container.getDataObject (/home/pi/reactor/server/lib/Container.js:91:53)
at Rule.getRuleStates (/home/pi/reactor/server/lib/Rule.js:601:98)
at Rule.getConditionState (/home/pi/reactor/server/lib/Rule.js:626:46)
at new Rule (/home/pi/reactor/server/lib/Rule.js:491:47)
at Function.getInstance (/home/pi/reactor/server/lib/Rule.js:500:36)
at /home/pi/reactor/server/lib/Engine.js:584:50
at Array.forEach (<anonymous>)
at Engine.checkData (/home/pi/reactor/server/lib/Engine.js:582:36)
Promise {
<rejected> SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IndividualFileStrategy.getDataObject (/home/pi/reactor/server/lib/IndividualFileStrategy.js:126:38)
at Container.getDataObject (/home/pi/reactor/server/lib/Container.js:91:53)
at Rule.getRuleStates (/home/pi/reactor/server/lib/Rule.js:601:98)
at Rule.getConditionState (/home/pi/reactor/server/lib/Rule.js:626:46)
at new Rule (/home/pi/reactor/server/lib/Rule.js:491:47)
at Function.getInstance (/home/pi/reactor/server/lib/Rule.js:500:36)
at /home/pi/reactor/server/lib/Engine.js:584:50
at Array.forEach (<anonymous>)
at Engine.checkData (/home/pi/reactor/server/lib/Engine.js:582:36)
}
Trace
at process.<anonymous> (/home/pi/reactor/app.js:197:151)
at process.emit (events.js:315:20)
at process.EventEmitter.emit (domain.js:467:12)
at processPromiseRejections (internal/process/promises.js:245:33)
at processTicksAndRejections (internal/process/task_queues.js:94:32)
2021-04-22T20:10:56.599Z Controller:WARN HubitatController#hubitat 'Allow control of HSM' appears to be disabled in your Maker API configuration
2021-04-22T20:10:56.604Z Controller:NOTICE HubitatController#hubitat current mode is Kv\u00e4ll (131)
2021-04-22T20:11:54.649Z Controller:ERR SystemController#reactor_system disk usage not available: Error: Cannot find module 'diskusage-ng'
Require stack:
2021-04-22T20:12:16.879Z Controller:ERR HubitatController#hubitat mapped capability x_hubitat_healthcheck has no implementation -
I have created a Global Reaction with this LUA code for my Vera to run.
However when I run the Reaction nothing happens. I can't see anything in the log file either about this rules ID number.
If I run the same LUA code on Vera in the test window it works OK.
OR any other suggestions how I can set this up in a global Reaction (Scene) in MSR ?
Instead I could use the VeraScenes.lua file in the Vera startup library, but I am wondering why I can't just paste the LUA code directly in to the MSR rule.
Thanks
local status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", 419) --Status of Safe to Arm virtual switch if status == "0" then --Safe to Arm luup.inet.wget("http://SOME-HTTP-REQUEST") luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","SetHouseMode", {Mode = 2}, 0) --Set House Mode to Away luup.inet.wget('SOME-HTTP-REQUEST' ,5); else --Not Safe to Arm luup.inet.wget("SOME-HTTP-REQUEST") luup.inet.wget('SOME-HTTP-REQUEST' ,5); end -
Hi,
I've been using Pushover in VeraAlerts, but now want to send my notifications from MSR.
I see in the reactor config directory that the notification. yaml file includes Pushover, but is showing #TBD. Is this where I need to set up my Pushover user key etc. and if so what and how should the information be entered?Any help would be appreciated.
-
For years of participating in the other community, I've watched people post a single error message from a log file when asking for help. I'm now seeing the same behavior (I guess not surprisingly, given the genesis of this community) here. But it's got to stop.
When you post just the error message, you leave out vital context that may give clues to more quickly troubleshoot whatever problem you are having. Very often, by the time someone responds to ask for more, the message is gone (e.g. rotating logs on Vera) or has become too difficult to locate.
Please, when posting anything from a log file, you should be giving context with the message by including, let's say at least 10, messages before, and a few after. Particularly in the case of MSR, almost every exception that is logged is accompanied by a context-defining message immediately before, and in many cases, a follow-on additional data dump related to the error.
Thanks for listening.
P.S. My weekly (it seems) reminder: when things go wrong that obviously aren't just the UI doing something dumb, you must look at the logs.
-
I have a rule that closes my curtains when I start my Xbox activity on the Harmony hub.
In the Contraints I have that it's day time.
In the Reset Reaction it opens the curtains when I end the Xbox activity etc.
Today it was day time and I started the Xbox activity and the curtains closed.
When I turned off the Xbox it was night time, however my curtains then opened.
I expected the curtains to remain closed as by then it was night time.
Not sure the best way to handle this? But I want a rule that closes the curtains if it's day time and I want to play on the Xbox. If it's still day time when I end that Harmony Activity then open the curtains again. Or if it's night time then keep the curtains closed.
I figure if I start playing the Xbox and it's already night time then the curtains would already be closed anyway via the sunset offset schedule that closes the curtains.
-
What does Blocked mean in running reactions?
Anyone having a lot of empty alerts that is not possible to erase?
Hubitat - MSR
/Mattias!
Skärmavbild 2021-04-22 kl. 12.09.15.png -
I'm moving the discussion on this out of the Mantis PR #178 for the benefit of all/documentation, and also because it's easier to type and format here.
@LibraSun wrote in that PR:
I'm 99% certain you'll explain this one away as "expected" but I naively believed it would yield different results:
In an expression defined by:
a=[1,2,3],
each i in a:
shift(a)
// result (array) [1,2] (unexpected
// expected [1,2,3]This has me thinking that 'each' is leaving items on the table, as I tried unsuccessfully pointing out above.
The issue here is that your expression shift(a) is modifying the iteration subject array in place. Basically, here are the iteration steps that are run, starting with a=[1,2,3]
First iteration: a=[1,2,3]; the local i is assigned the first array element 1, but it is not used in the expression. The expression shift(a) results in 1 and causes a to be reduced to [2,3] (the first element is shifted off and becomes the result). Since this is the last value in the expression, 1 is added to the each result array. Second iteration: a is now [2,3] because the previous iteration modified it. So i is assigned 3, because the iteration is on the second element/iteration through the array, but i is not used in the expression. The shift(a) causes a to be reduced to [3] and its return value is 2, so the value 2 is added to the iteration result array. Third iteration: a is now [3], and we are on the third iteration, but the iteration index of 3 (third iteration) is now off the end of the array (only 1 element long), so iteration stops.The result of this each is therefore [1,2] because those are two values that were shifted out, and a is left at [3] because there was no third run of shift() to remove it.
As I said in the PR, modifying an array you are iterating through can be dangerous and confusing in many languages, because iterators keep state during iteration, and some operations you can do inside the iteration can and will invalidate that state in some way. In Lua on Vera, this often leads to deadlocks and crashes so bad that the box reboots, not just a Luup reload. It's a Bad Idea, and programmers who know are very wary of doing this type of thing in any language unless they are certain of the side-effects/lack of side-effects.
Your additional example:
a=[1,2,3], // The array 'a' is [1,2,3]
a=unshift(a,0), // The array 'a' is [0,1,2,3]
a=push(a,4), // The array 'a' is [0,1,2,3,4]
each i in a: // Iterating over the 5 elements of 'a'
shift(a) // Take the first element of 'a' and append it to result array [ ]
// result [0,1,2] (unexpected)
// and array 'a' is now [3,4]! (also unexpected)Also correct result. All of the gyrations before the each are not relevant to behavior here. At the start of the each, the array is [0,1,2,3,4] (5 elements). Iterations:
a=[0,1,2,3,4], i=0, shift(a) returns 0 and modifies a to [1,2,3,4]; the each result array is now [0] a=[1,2,3,4], i=2, shift(a) returns 1 and modifies a to [2,3,4]; the each result array is now [0,1] a=[2,3,4], i=4, shift(a) returns 2 and modifies a to [3,4]; the each result array is now [0,1,2] Iteration stops because the iteration index/step is 4, but there remain only two elements in a=[3,4] (we're off the end of the array).So the each result is [0,1,2] and a is left with [3,4] and this is correct operation.
Key points:
each keeps state during the iteration (as most iterators do) about the subject of the iteration; if the subject changes in a way that affects the state, unexpected results may occur; The functions push(), pop(), shift() and unshift() modify the array in place. If you say b=shift(a) you get a value in b and a modified (shorter) a. -
-
Just thought i'd mention it, as I've walked into it multiple times when editing rules:
dbc9e2c8-887e-46bd-8e3c-1364eb99bb03-image.pngWhen I make/edit rules, i'm used to pressing "save" through the process, and when I do that, theres only the red one left to press. It does make sense, as its already saved, but I'll stop and think one more time when it says w/o saving.
In my head, a exit button which causes a pop-up warning if changes are not saved makes more sense - like in vera reactor.Feel free to discard the idea, its just something to get used to mabye. 🙂
-
Followers will be aware of the problems I had setting up MSR, so it won;t come as a surprise that now I have problems Upgrading to the latest version. (How much I wish for a "Click to Upgrade" Button.....)
I've been stuck on this for 6 days and am ready to throw in all into the to hard basket, surely HA shouldn't be this problematic?
There, I've said it now I feel better....
So what's the problem, I can upload the file using WINSCP but no matter what I've tried it won't un-tar and over write the existing files in the Reactor Directory.
I receive the following error message which may as well be written in Martian 🙂 in my case.
Command 'tar -xz --directory="reactor" -f "reactor-0.1-21101-0db64f0-generic.tar.gz"'
failed with return code 2 and error message
tar: reactor: Cannot mkdir: Permission denied
tar: reactor: Cannot mkdir: Permission denied
tar: reactor/INSTALL.md: Cannot open: No such file or directory
tar: reactor: Cannot mkdir: Permission denied
tar: reactor/LICENSE.md: Cannot open: No such file or directory
tar: reactor: Cannot mkdir: Permission denied
cut for sanity sake....This goes on for ad infinitum for every file.
I tried with both users, no change, can anyone decipher this and explain why WINSCP won't untar the file?
-
How can I do this?
The topic in the instructions is very limited.Other Controllers
Other controllers that you may find as add-ins will each have their own specific configuration instructions. Please refer to their accompanying documentation.What information should I be looking for?
I've tried port 1880 which is used for node-red, assuming that this is a listening port - no go. Really not sure how to go about this as everything I do is mostly trial & error.
BTW, I added my Vera Lite into the mix successfully, HS4 would make it a trifecta!
-
Hi Everyone,
In the Vera Reactor logic, I used to use the operator "updates" in a lock condition.
If I entered the door and the code used was "Mike," it would hold the condition true indefinitely because "Mike" was the last stored value. Since it is held indefinitely, setting the condition to pulsed would not allow the condition to fire again because it never went false. If I entered a different code, the condition would go false, then entering "Mike" again would cause the condition to go true.
I did this using the operator "updates" in an AND condition along with the lock code. The code condition would stay true with "Mike," and when "Mike" is entered consecutively, the "updates" condition will go true each time, and then the whole condition would go true, triggering the action.
Since "updates" no longer appears to be an operator, how would I do this in the new logic? I think I remember a discussion about this, but I searched and can't seem to find it.
I'm not a programmer, so I am probably missing the easy way to do this.
-
For MSR users with SiteSensor still installed back on Vera, you might want to consider letting MSR take over those duties. Here's a quick run-down of how I imported one of my SiteSensor recipes into a Rule on MSR, using OpenWeather API* as an example.
STEP 1: Copy the Basics from Vera
(a) Go to your Vera > Devices, locate SiteSensor (the main instance, not one of its children devices) and click ► for details then click SETTINGS.
(b) Copy and paste (into Notepad or other text editor) the Request URL along with each of the defined expressions.STEP 2: Create a Rule on MSR
(c) Jump into Rule Sets and click "Create Rule". Click its title to rename the rule 'OpenWeather (API)" and click 'Rename'.
(d) Decide on appropriate Triggers (in my case, it's an OR group that includes an [INTERVAL] set to "Every 3 hours" plus a few [ENTITY ATTRIBUTE] entries reacting to things like entering/leaving home, waking up, etc.).
(e) In Set Reacion, create an [HTTP REQUEST] > [GET] action.
(f) Paste your old "Request URL" into the "Request URL" box.FYI GET calls to OpenWeather API* take the form:
http://api.openweathermap.org/data/2.5/weather?zip=<your_ZIP_code>&id=<your_Wx_ID>&appid=<app-id>&units=imperial(g) Create four new blank Expressions (name them openWx, Tx, Hx and Rx).
(h) Click SAVE & EXITSTEP 3: Process the Response
(i) Re-open rule "OpenWeather (API)" by clicking the 'Edit' icon.
(j) Within the [HTTP REQUEST] action, assign "Capture response to:" ► openWx
(k) Down in Expressions, click "[+]Add Expresssion" then enter the following:
Tx := round(openWx.main.temp,1)
// yields current outdoor temperature
Hx := round(openWx.main.humidity)
// yields current humidity conditions
Rx := openWx.rain ? ( openWx.rain['3h'] ? openWx.rain['3h'] : 0) : 0
// yields predicted rainfall, if present; otherwise 0
(l) Click SAVE & EXIT. Enjoy!Naturally, your specific needs and workflow will differ from the one I've outlined here. For instance, you may wish to explore the contents of the JSON object in openWx for additional data of interest to you, and define variables to match.
My goal here has been to illustrate some key concepts needed for moving from SiteSensor over to MSR:
Some syntax is the same, such as dot notation for object.item.access; Other syntax has changed, such as the use of ternary A ? B : C in place of IF (A, B, C); Manually setting an [INTERVAL] in lieu of SiteSensor's timed schedule;Pro tip: If your workflow demands that other Rules react to the output of the "OpenWeather (API)" rule, then be sure to create all of the aforementioned Expressions under "Global Expressions" instead, so they become accessible across all Rule Sets.
Once the transition is complete, you can either DISARM SiteSensor on Vera or remove it entirely with "Remove Device" (which will automatically remove all of its child devices).
*Additional reading:
OpenWeather API : https://openweathermap.org/api
FREE SUBSCRIPTION REQUIRED TO USE THIS SERVICEPRO TIP: See below for optimal way to incorporate OpenWeatherMap into your MSR workflow(s), by enabling the service directly in the reactor.yaml config file.
-
In my Vera config I have two SiteSensors (one for Ambient Wx, one for OpenWxMap) that point to two unique Reactor devices for controlling HVAC in my home. This is done for redundancy - if the Ambient API drops it returns zero data which then triggers a standalone Master API Reactor device to flip on the OWM SiteSensor and corresponding HVAC Reactor device to continue controlling the house conditions.
Once the Ambient API returns to available the Master API Reactor device flips back to the Ambient SiteSensor and corresponding HVAC Reactor device, turning OFF the SiteSensor for OWM to save on API calls.
I've been able to duplicate one half of this, including the Master API role, in MSR. But... here's the tricky part... I can't turn "off" the MSR Rule Sets for the OWM version. As such, HVAC is sent conflicting data and doesn't know what to do.
Before I go alls deep into explaining how all of this currently works, am I missing something somewhere that would allow me to trigger the on/off of MSR Rule Sets?
-
Knowing that MSR Preview may not yet fully implement LuaXP (CORRECTION: MSR uses a different language lexpjs), I could not resist whipping up some text expressions for fun. Whereupon two things popped out at me:
The new scaling (0.00 - 1.00) of Dimming Level will require a rewrite of certain Expressions that I use to balance my light levels. For example, it was my custom to monitor one lamp's brightness (0 - 100) with Reactor Luup, then set another lamp to 93% of that level, using this Expression: floor(getstate( 9, "urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget" ) * 0.93)Now, in MSR, it will become necessary to modify that to read:
floor ((getEntity( "vera>device_9" ).attributes.dimming.level * 0.93)*100)/100which effectively scales the value up x 100 (so that floor() can act upon it correctly), then downscale it / 100. Just an FYI to ponder.
I'm noticing that every edit, however minor, of an Expression in MSR requires an immediate SAVE click before the 'Run' button will become active. That is to say, I cannot repeatedly evaluate the Expression during editing, without clicking SAVE first.Only mentioning this latter behavior since it departs so dramatically from Reactor Luup's paradigm.
-
Hi
I am assuming in time MSR will have some API documentation.
I am going to ask Bill the developer of the Home Remote dashboard app if he can add support for MSR.
Specifically support for MSR global Reactions (Scenes), where hopefully they can be imported in to the Home Remote Designer application and then we can more easily create dashboard tiles that when pressed would run a particular MSR global Reaction etc.
Currently in Home Remote it's possible but not so easy to create a tile that runs a http request when pressed and I have tested this and it does work and will run an MSR global Reaction.
But I'd much prefer if in the Home Remote Designer application MSR could be added as a device type and then all its global Reactions
imported as it does with Vera and other systems. -
-
How are folks handling situations where they want to have Conditional Actions or Branching Logic in their Set Reactions for a rule? Are you creating Duplicating the same trigger and setting different conditions and Actions?
Is there an approach where you combine a main rule with your entity triggers with sub rules that trigger off Expressions? You then could write your conditions as Set Variable actions in the Main Rule for the Expressions that evaluate to true or false. Each sub rule would trigger based on the expression changing to true and then could also change it back to false after.
Not sure if that's worth the complexity for the reusability and control over duplicate triggers.
-
OK, people, here we go! At long last, Multi-System Reactor developer preview is available!
The package can be downloaded from the Reactor bug tracker, a MantisBT system (at https://reactor.toggledbits.com/mantisbt/). There is a download button in the left margin, as well as links to the documentation, which you will need for installation.
UPDATE 2021-02-24 -- To keep spammers off, I've locked down registration on the Bug Tracker. To get access to the Bug Tracker and preview downloads, please PM me (not reply here) your full name and email address and I will set up an account for you.
This version of MSR will run on Linux systems, including RPi's under Raspios Buster, running node.js version 12.10 or higher (v14.15.1). For RPi users, there is an installation script that will install a local copy of node.js (for the logged-in user).
Bugs reports will be handled through the bug tracker only. Discussion and questions in this forum are fine, though (if that leads to a bug report, we'll transition).
This version supports Vera (and openLuup to the degree it's compatible with Vera Luup), Hubitat, and Home Assistant. Some of the device support on the H platforms is still a bit basic, but it is largely controlled by configuration and progress can be made quickly.
The documentation beyond installation is a mess. Of course, I started with the existing documentation and have been massaging into MSR's particulars, but it still has a long way to go on the detail.
I know I don't have to say this, but I will anyway... let me know how it goes!
-
I looked through the forum, but could not find it, so my apologies if this has been asked. It would be nice to be able to push a message to MQTT for further upstream integrations.
Status Tab Preview
-
The status tab is starting to come together, and is supported in part by a new Alerts mechanism.
This is the place for discussion about that. Please don't open PRs at this point, as I'm not finished with the work. I estimate I'm about half done with what I know I have to do so far, and I imagine more to come later. If you have bugs to report, I'll take them here in this thread.
-
It's lookin' mighty good. Props to you, sir!
-
Nice! is a "Changed by" (rule/expression) column in that lower table in the works as well?
-
In the Entities? Probably not. How would I know what changed it?
-
Nice, good work! I wait with my suggestions until I see what you have in mind.
-
The ALARM BELL already saved my bacon. A couple of otherwise "proven good" Rules evidently went rogue after I switched from detecting House Mode with Reactor (which yielded numbers 1, 2, 3, 4) to MSR's Vera > HouseMode feature (which yields strings "home", "away", "night" and "vacation"). This meant rewiring my logic flow, which got a bit out of kilter.
Anyway, MSR's "Status" report caught some unexpected "NULL" evaluations in the Trigger conditions, which led me down the proper rabbit hole to fix those and get both Rules back on track.
TIP: To account for the "NULL" condition (coming from a failed lookup in a "table" object I created -- see the ecobee plug-in is notorious for throwing an empty value back for
Thermostat Mode
in certain not-so-rare circumstances), I simply moved from:[ Expression Value ] [ modesMatch ] [ is FALSE ] // was bombing when NULL
to
[ Expression Value ] [ modesMatch ] [ <> ] [ TRUE ] // works when FALSE or NULL
P.S. Oddly, the "Alarm Bell" icon remains red even after resolving the alerted conditions. (Solved with browser refresh)
-
-
-
-
@toggledbits i'm thinking if some rule in reactor changed the state of the entity, it could be a column to identify that rule. changes done by others could simply state "other" or similar.
This is related to the other inquiry i had about entity change history..
-
Yeah, but there's no way to determine that.
-
@cw-kid Same here. It is flooded by changes from the rooms
-
One of my Alerts says "
Unable to resolve global expression "timeStamp"
Last 22:23:06; this alert has repeated 3 times." ... yet I have no such variable. Perhaps I once did but not now that I can tell. -
Something is referring to it...
...and yes I realize I need to make finding that something easier but, steps... one thing at a time...
-
Just as:
Reaction task "66" failed due to an exception TypeError: Cannot read property 'length' of undefined Last 09:21:10
must point to /something/ but I stand to be educated on where to look. The reactor Log, perhaps?
EDIT: Found line by searching for "length" in reactor.log.1 (downloaded from Synology NAS). Doesn't specify exactly what component the problem is with, but it did name the affected Rule. I suspect it's to do with a long JSON string in one of its variables that happened to contain an empty array as a 'value'.
-
Yes, log. All kids love log.
-
Do we really want disabled rules to appear among the list of Set Rules in status?
-
Can confirm the new Alert notification is working in a Reaction and puts an alert right on to this Status page under Current Alerts.
-
Neat! Will "clicking the red bell" eventually take us directly to the Alerts panel?
-
Also, so as to minimize the number of "SET" (but otherwise inactive) Rules, I decided to change all of my
[ Entity Attribute ] [ X ] [ is FALSE] // remains true indefinitely when OFF
to
[ Entity Attribute ] [ X ] [ changes ] [ (any) ] to [ FALSE ] // only true briefly when turned OFF
Dunno if I'm OCD or just didn't want Status implying that something was "going on" when it's not.