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
    (Last Updated: February 24, 2021)
    For those who registered but didn't received the confirmation email, please send an email to support@smarthome.community with the email you used
    • Low-priority GUI feedback

      PerH

      Just thought i'd mention it, as I've walked into it multiple times when editing rules:
      dbc9e2c8-887e-46bd-8e3c-1364eb99bb03-image.png

      When 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. 🙂

      Multi-System Reactor
    • Home Assistant, ReferenceError: auth is not defined

      A

      I doesn't succeed with connection to my home assistant.
      Anyone that can see what's wrong?
      I have also tried with token between " instead of '

      From reactor.yaml

      - id: hass enabled: true implementation: HassController name: Hassio config: source: 'ws://12.12.12.9:8123' access_token: 'Rm97bt83DGwqyfv4c6wiQRPByhbkJmnYwviP8MLQZXw'

      From command window:

      PS C:\reactor> node app.js Configuration path: config resolved C:\reactor\config 2021-02-28T17:45:25.872Z <app:null> Reactor "0.1.21058" starting on v14.16.0 2021-02-28T17:45:25.874Z <app:INFO> Process ID 1408; platform win32/x64 Windows 10 Education 2021-02-28T17:45:25.875Z <app:INFO> Home C:\reactor; data in . 2021-02-28T17:45:25.894Z <default:INFO> Module Entity v21057 2021-02-28T17:45:25.898Z <Controller:null> Module Controller v21058 2021-02-28T17:45:25.908Z <default:null> Module Structure v21050 2021-02-28T17:45:25.917Z <default:null> Module Ruleset v21041 2021-02-28T17:45:25.919Z <default:null> Module Rulesets v21041 2021-02-28T17:45:25.938Z <default:null> Module Rule v21058 2021-02-28T17:45:25.942Z <default:null> Module Engine v21055 2021-02-28T17:45:25.944Z <default:null> Module httpapi v21041 2021-02-28T17:45:25.954Z <default:null> Module httpproxy v21054 2021-02-28T17:45:25.985Z <default:null> Module wsapi v21053 2021-02-28T17:45:25.987Z <app:NOTICE> Starting HTTP server and API... 2021-02-28T17:45:25.996Z <httpapi:NOTICE> HTTP API v1 21041 base URL http://12.12.12.12:8111; listening 2021-02-28T17:45:26.007Z <app:NOTICE> HTTP server running; registering proxy endpoints. 2021-02-28T17:45:26.008Z <app:NOTICE> Starting WSAPI... 2021-02-28T17:45:26.009Z <wsapi:NOTICE> wsapi: starting version 21053 2021-02-28T17:45:26.011Z <app:NOTICE> Endpoints up; starting Structure... 2021-02-28T17:45:26.012Z <Structure:INFO> Structure#1 starting controller interface vera (VeraController) 2021-02-28T17:45:26.018Z <Structure:INFO> Structure#1 starting controller interface hass (HassController) 2021-02-28T17:45:26.021Z <Structure:INFO> Structure#1 starting controller interface weather (OWMWeatherController) 2021-02-28T17:45:26.022Z <Structure:INFO> Structure#1 starting controller interface reactor_system (SystemController) 2021-02-28T17:45:26.047Z <default:null> Module VeraController v21058 2021-02-28T17:45:26.052Z <default:null> Module HassController v21053 2021-02-28T17:45:26.054Z <default:null> Module OWMWeatherController v21027 2021-02-28T17:45:26.065Z <default:null> Module SystemController v21054 2021-02-28T17:45:26.076Z <VeraController:NOTICE> VeraController#vera starting 2021-02-28T17:45:26.079Z <VeraController:INFO> VeraController#vera loaded mapping ver 21057 rev 2 format 1 notice 2021-02-28T17:45:26.109Z <Controller:INFO> HassController#hass device data loaded; checking structure 2021-02-28T17:45:26.111Z <Controller:ERR> ./server/lib/hass_devices.yaml implementation of capability hvac_blower_swing uses unknown attribute mode 2021-02-28T17:45:26.112Z <Controller:WARN> ./server/lib/hass_devices.yaml implementation of capability hvac_blower_swing does not provide attribute swing; using fixed value=(null) 2021-02-28T17:45:26.129Z <Controller:NOTICE> HassController#hass attempting reconnection to ws://12.12.12.9:8123/api/websocket 2021-02-28T17:45:26.130Z <Controller:NOTICE> HassController#hass connecting to ws://12.12.12.9:8123/api/websocket 2021-02-28T17:45:26.155Z <Controller:NOTICE> Controller SystemController#reactor_system is now online. 2021-02-28T17:45:26.170Z <app:INFO> Structure is now running 2021-02-28T17:45:26.171Z <app:INFO> Pausing for controllers' initial ready 2021-02-28T17:45:26.190Z <Controller:NOTICE> HassController#hass connected, starting protocol 2021-02-28T17:45:26.200Z <Controller:ERR> HassController#hass message handler for auth_invalid failed: ReferenceError: auth is not defined 2021-02-28T17:45:26.210Z <Controller:NOTICE> HassController#hass websocket closed, 1000 2021-02-28T17:45:26.286Z <OWMWeatherController:NOTICE> Controller OWMWeatherController#weather is now online. 2021-02-28T17:45:26.466Z <VeraController:NOTICE> Controller VeraController#vera is now online. 2021-02-28T17:45:26.505Z <OWMWeatherController:ERR> [Entity:setPrimaryAttribute] Attempt to set primary to power_switch.state invalid, not in { "x_vera_rgbcontroller_plugin": { "device_type": "ZWaveColorDevice", "configured": true, "color": "#e900ff0000", "message": "" } } 2021-02-28T17:45:26.506Z <VeraController:ERR> VeraController#vera exception/error while updating VeraController#vera 2021-02-28T17:45:26.507Z <VeraController:CRIT> Error: Entity#vera>device_235:setPrimaryAttribute() can't set power_switch.state, not defined for entity Error: Entity#vera>device_235:setPrimaryAttribute() can't set power_switch.state, not defined for entity at Entity.setPrimaryAttribute (C:\reactor\server\lib\Entity.js:364:19) at C:\reactor\server\lib\VeraController.js:692:118 at processTicksAndRejections (internal/process/task_queues.js:93:5) Error: Entity#vera>device_235:setPrimaryAttribute() can't set power_switch.state, not defined for entity at Entity.setPrimaryAttribute (C:\reactor\server\lib\Entity.js:364:19) at C:\reactor\server\lib\VeraController.js:692:118 at processTicksAndRejections (internal/process/task_queues.js:93:5) 2021-02-28T17:45:31.213Z <Controller:NOTICE> HassController#hass attempting reconnection to ws://12.12.12.9:8123/api/websocket 2021-02-28T17:45:31.215Z <Controller:NOTICE> HassController#hass connecting to ws://12.12.12.9:8123/api/websocket 2021-02-28T17:45:31.226Z <Controller:NOTICE> HassController#hass connected, starting protocol 2021-02-28T17:45:31.237Z <Controller:ERR> HassController#hass message handler for auth_invalid failed: ReferenceError: auth is not defined 2021-02-28T17:45:31.256Z <Controller:NOTICE> HassController#hass websocket closed, 1000 2021-02-28T17:45:36.258Z <Controller:NOTICE> HassController#hass attempting reconnection to ws://12.12.12.9:8123/api/websocket 2021-02-28T17:45:36.260Z <Controller:NOTICE> HassController#hass connecting to ws://12.12.12.9:8123/api/websocket 2021-02-28T17:45:36.272Z <Controller:NOTICE> HassController#hass connected, starting protocol 2021-02-28T17:45:36.283Z <Controller:ERR> HassController#hass message handler for auth_invalid failed: ReferenceError: auth is not defined 2021-02-28T17:45:36.298Z <Controller:NOTICE> HassController#hass websocket closed, 1000 2021-02-28T17:45:41.302Z <Controller:NOTICE> HassController#hass attempting reconnection to ws://12.12.12.9:8123/api/websocket 2021-02-28T17:45:41.303Z <Controller:NOTICE> HassController#hass connecting to ws://12.12.12.9:8123/api/websocket 2021-02-28T17:45:41.314Z <Controller:NOTICE> HassController#hass connected, starting protocol 2021-02-28T17:45:41.336Z <Controller:ERR> HassController#hass message handler for auth_invalid failed: ReferenceError: auth is not defined 2021-02-28T17:45:41.353Z <Controller:NOTICE> HassController#hass websocket closed, 1000 2021-02-28T17:45:46.355Z <Controller:NOTICE> HassController#hass attempting reconnection to ws://12.12.12.9:8123/api/websocket 2021-02-28T17:45:46.357Z <Controller:NOTICE> HassController#hass connecting to ws://12.12.12.9:8123/api/websocket 2021-02-28T17:45:46.368Z <Controller:NOTICE> HassController#hass connected, starting protocol 2021-02-28T17:45:46.377Z <Controller:ERR> HassController#hass message handler for auth_invalid failed: ReferenceError: auth is not defined 2021-02-28T17:45:46.394Z <Controller:NOTICE> HassController#hass websocket closed, 1000 2021-02-28T17:45:47.169Z <app:NOTICE> Shutdown signal (SIGINT) received. Stopping Reaction Engine... 2021-02-28T17:45:47.172Z <Engine:NOTICE> Engine#1 has shut down. 2021-02-28T17:45:47.172Z <app:NOTICE> Closing APIs... 2021-02-28T17:45:47.173Z <wsapi:NOTICE> wsapi closing... 2021-02-28T17:45:47.179Z <httpapi:NOTICE> HTTP API closing... 2021-02-28T17:45:47.180Z <app:NOTICE> Closing Structure... 2021-02-28T17:45:47.181Z <Structure:INFO> Structure#1 Stopping controllers... 2021-02-28T17:45:47.183Z <VeraController:NOTICE> VeraController#vera stopping 2021-02-28T17:45:47.184Z <Controller:NOTICE> HassController#hass stopping 2021-02-28T17:45:47.189Z <Controller:NOTICE> HassController#hass stopping 2021-02-28T17:45:47.190Z <OWMWeatherController:NOTICE> OWMWeatherController#weather stopping 2021-02-28T17:45:47.190Z <OWMWeatherController:NOTICE> OWMWeatherController#weather stopping 2021-02-28T17:45:47.191Z <Controller:NOTICE> SystemController#reactor_system stopping 2021-02-28T17:45:47.193Z <Controller:NOTICE> SystemController#reactor_system stopping 2021-02-28T17:45:47.194Z <Structure:INFO> Structure#1 Final data sync... 2021-02-28T17:45:47.199Z <Structure:NOTICE> Structure Structure#1 stopped 2021-02-28T17:45:47.199Z <app:NOTICE> Stopping timers... 2021-02-28T17:45:47.200Z <app:NOTICE> Shutdown complete, process ID 1408 2021-02-28T17:45:47.201Z <wsapi:NOTICE> wsapi: server closed FORCED EXIT
      Multi-System Reactor
    • Constraints (no data) rule actions have never run

      cw-kid

      Hi

      I have a problem rule it seems. Its set to turn off my Festoon lights at 23:55pm and in the constraints checks if those lights are already turned on ?

      And the reaction is to turn them off.

      Since I setup the rule my lights have never turned off.

      In the summary card I can see (no data)

      On this screen shot it says the power switch state is TRUE.
      The switch is actually OFF at the moment, I have hard refreshed the browser but it still says True.

      dacb145e-8c3a-49a6-8fc8-aff6ff9e65d4-image.png

      I can go to Scope and add a trace on this device and it does track if its turned on or off OK.

      The device is one side of a Fibaro Dual Relay module.

      Any clues?

      Thanks

      Multi-System Reactor
    • Timers in my log

      M

      Question about my logs. My logs are filled with timers, even with the log-level 4. Is this expected or why are they here?
      Screenshot from 2021-02-28 08-24-50.png

      Multi-System Reactor
    • MSR in Alpine Docker

      PerH

      I have a docker running smoothly now, thought i'd share it. (and BTW, it looks awesome, Patrick!)
      So far i've only opened 8111, and /config as volume. Mabye the full /reactor folder should be exposed for easy updating?

      docker compose:

      version: "3.9" services: MSR: container_name: MSR restart: always image: perhu/msr-alpine:latest ports: - "8111:8111" volumes: - type: volume source: MSR-config target: /etc/reactor/config - type: volume source: MSR-Storage target: /etc/reactor/storage volumes: MSR-config: name: MSR-config MSR-storage: name: MSR-storage

      dockerfile for those who want to modify the image:

      FROM alpine:latest COPY /reactor/. /etc/reactor/ RUN apk add --update nodejs npm && cd /etc/reactor \ && npm install --loglevel error --no-save \ && cp dist-config/* config/ VOLUME ["/etc/reactor/config"] VOLUME ["/etc/reactor/storage"] EXPOSE 8111 CMD ["/bin/sh"] WORKDIR /etc/reactor CMD ["node", "/etc/reactor/app.js"]
      Multi-System Reactor
    • Delays not working as expected

      J

      I seem to be having some issues with delays, so I set up a test as follows:

      38b96d15-e56b-4a53-bc55-861789e77194-image.png

      14bc4aab-ec56-46d3-b81d-04797f92eb74-image.png

      258343a3-e489-43ef-99d5-ae1a76b30ad2-image.png

      If the second rule is disabled, the first rule works as I expect - when motion is detected in the Hall, the Hall lamp switches on and then off again 10 seconds later.

      With both rules enabled - when motion is detected in the Hall the Hall lamp switches on, but then if motion is detected in the Dining room, the Dining room lamp switches on, but the Hall lamp does not switch off after the 10 seconds , but after the 30 seconds when both lamps switch off at the same time.

      Is this a bug, or just my understanding of how it should work?

      Multi-System Reactor
    • Trying to work around no lua reactions

      T

      Hey Patrick,

      So I had mentioned earlier that I was using some lua in my reactor activities. I had the idea to move the lua into vera scenes and invoke the scene in a MSR reaction. The problem is I am getting a lot of luup restarts. I tried rebooting the vera as well but it remains unstable. i never really had a problem running the lua within reactor. A example of the lua I am using is to send IR codes to my older TV's that only support IR. Code as follows

      --[[Samsung TV Antenna----]] local socket = require("socket") tcp = assert(socket.connect("192.168.255.204", 4998)) tcp:send("sendir,1:3,1,38000,1,1,172,172,21,64,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,21,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,21,21,21,21,64,21,64,21,64,21,1673" .. "\r\n") tcp:close()

      So I though I would try the Global Cache CG100 plugin that is a Vera App that will also send the codes. It does show up under entity action but the sendcodeset option is not available. The following pictures show how it looks under Vera Reactor and MSR.

      Screen Shot 2021-02-26 at 8.49.35 PM.png

      Screen Shot 2021-02-26 at 8.53.03 PM.png

      Multi-System Reactor
    • Synology Docker installation

      LibraSun

      @toggledbits I followed to the letter your excellent step-by-step guide on launching a Docker container from the image I fetched from PR #58 this morning.

      All proceeded swimmingly – folder creation, image upload, settings & parameters, etc. – until the moment of actual Launch.

      Whereupon, Docker threw up the following on-screen "Stopped Unexpectedly" warning (which repeated every 30 seconds or so until I Stop'ped the container from running/restarting):
      docker_msr_stopped.png

      Concurrently, every attempt to access http://<mySynNAS_IP>:8111/ resulted in a "This site can't be reached" error page in Chrome (under Windows, mind you).

      Immediately, I took the liberty of inspecting and Export'ing the logfile (Container ► Details ► Log) as an HTML file, which I attach below (oops, no attachment feature in this forum, so here is the direct link) for your inspection.

      Hope you find some clues, because I'm not at all sure where things went wrong. (The only facet of setup where I expressly deviated from your typed notes involved creating a "Shared" (i.e. top-level, rather than under /home) folder called "Reactor" with r/w access, under which I created a subfolder named "Data", to which I pointed /var/reactor during container creation.)

      Excellent write-up and thanks for the chance to test this out!!

      Libra

      FOLLOW-UP NOTES
      I do see where Container ► Edit ► Environment ► variable PATH has a value of "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" which strikes me as odd, but maybe that's normal nomenclature? (By contract, Windows and DOS always use semicolons, not colons, to separate PATH variable entries.)

      RESOLVED
      Noting that the Log displayed an error message related to /var/reactor/config, I went and created a folder named 'config' (all lowercase) under the NAS's top-level Reactor\Data folder, then restarted the container. It's running fine now, and I'm able to access the :8111 interface for the first time.
      Log ► "Configuration path: /var/reactor/config resolved /var/reactor/config"

      SUGGEST
      Please add explicit declaration in your How-To regarding the need for a /config underneath the data folder.

      Multi-System Reactor
    • Multi-System Reactor Developer Preview AVAILABLE

      toggledbits

      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, 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!

      Multi-System Reactor
    • Import question

      T

      Is the import feature supported by stock Vera or only open loop or is it both?

      Multi-System Reactor
    • OpenLuup entities flashing

      rafale77

      Scenes and room don't flash as frequently as they used to but they still do.
      I am starting a thread here though it seems to be an openLuup issue.
      Everytime something in a room updates, the room entity flashes which is to be expected but I am seeing the same thing with scenes which are not running or triggered.

      I also open a ticket regarding an error I am seeing at startup regarding HVAC devices on openLuup which appears to be a syntax error.

      Multi-System Reactor
    • Another install issue

      T

      I am stuck at step 7 of

      New Install: Linux (various) - Bare Metal (without Docker)

      I do not see the file config/reactor.yaml in the reactor directory.

      Multi-System Reactor
    • Dashboard graphical issue

      rafale77

      Screen Shot 2021-02-25 at 19.56.59.png

      Some font issues to be addressed I think on the dashboard.

      Multi-System Reactor
    • Issue with this Night rule?

      cw-kid

      Hi

      I have a rule that turns on my interior porch entrance light when its night and the front door is opened.

      Its set to keep the light on for 1 minute and then turn it off.

      I've been back in the house for well over an hour but just noticed the porch light is still on and hasn't turned off.

      Its 21:17 pm here now.

      This is the rules summary card:

      d3dd2022-256c-4e75-b93b-3d1f40a9689b-image.png

      I setup the Night rule as a Global Rule and its referenced in this rule.

      Any clues ?

      Thanks

      EDIT: I should add that this rule has worked OK previously and the light has turned off after I have entered and the minute has passed.

      Multi-System Reactor
    • Installation trouble

      T

      Trying to install under termux on my nvidia shield. Having a problem unpacking. See attached picture.

      20210225_225921.jpg

      Multi-System Reactor
    • Support for 3rd party Vera plugins ?

      cw-kid

      Hi

      Does the Reactor plugin for Vera support some 3rd party Vera plugins such as the Logitech Harmony plugin for example ?

      In PLEG I am able to select a Harmony hub device and create some logic based on its various states.

      2ecefb43-5b2d-4505-aef1-dd0c5b09dc3f-image.png

      Other plugin examples might be the RGB Controller plugin which I am using with Fibaro RGBW modules, I can start the various light animations on the Fibaro RGBW module.

      19962434-a707-4301-b168-00787fea16ed-image.png

      8a629a9c-1968-40d8-a7c2-129bfebc9ac2-image.png

      Or the AltHue plugin which exposes aspects of the Hue Bridge like ColorLoop or to be able to start Hue Scenes etc.

      a8a67942-b862-4c3e-871f-f41081b20e8c-image.png

      With MSR all this type of functionality is currently lost.

      Obviously a work around would be to create Vera scenes instead and have those use these types of 3rd party plugins features and have MSR call those scenes. Don't think that would work for the Harmony plugin though where you are wanting to query states of the hub in your logic.

      I am just wondering how Reactor plugin for Vera currently works in this respect and what any plans for MSR might be ?

      Thank you.

      Multi-System Reactor
    • Installing MSR on Windows

      A

      @toggledbits said in Multi-System Reactor Developer Preview AVAILABLE:

      Version 21054 now available.
      ...
      2. This version runs on Windows, and there are draft instructions for how to get it installed.

      I am so excited!

      Sorry that I need to bother with a noob question at the first step😂
      Does this box need to be checked for MSR to run nicley?
      7bc519af-f0e4-46af-a040-0ce261d08a8f-image.png

      Multi-System Reactor
    • ALTHUE and Harmony mappings

      toggledbits

      Go ahead and open a PR for it, and we'll use that to track it.

      Multi-System Reactor
    • Setting RGB colour values

      cw-kid

      "You need to use 0.0 to 1.0, not 0 to 255 (just like dimming values)."

      How would I set the colour Purple as an example ?

      Its RGB value is: 128, 0, 128

      Thanks

      Multi-System Reactor

    IF Else without LUA Code ?

    Multi-System Reactor
    3
    10
    67
    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

      I guess there is no way to do IF Else statements without using LUA code ?

      This is a small portion of code, I've just copied out of one of my PLEG actions run LUA Code.

      The code checks a WOL with Ping switch in Vera, if its ON, it then sends a particular HTTP request to that Kodi HTPC to bring an IP Camera image on screen

      It then does the same check for the next WOL with Ping switch / Kodi HTPC and so on etc.

      Also the code checks Harmony activities to see if I'm currently in a FireTV activity instead? and if so sends a particular HTTP request to do Picture in Picture on the FireTV stick.

      local status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", 38) --Check Status of KODI01 WOL switch
      if status == "1" then --If on then send command to show Security Cam
        os.execute('curl -X POST -H "content-type:application/json" http://kodi:kodi@192.168.1.101:8080/jsonrpc -d \'{"jsonrpc":"2.0","id":1,"method":"Addons.ExecuteAddon","params":{"addonid":"script.frontgardencam"},"id":"1"}\'')
      else
      end
      
      local status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", 39) --Check Status of KODI02 WOL switch
      if status == "1" then --If on then send command to show Security Cam
        os.execute('curl -X POST -H "content-type:application/json" http://kodi:kodi@192.168.1.102:8080/jsonrpc -d \'{"jsonrpc":"2.0","id":1,"method":"Addons.ExecuteAddon","params":{"addonid":"script.frontgardencam"},"id":"1"}\'')
      else
      end
      

      I can't see that this would be possible using just an MSR rule ?

      Thanks

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

        seem there is a ternary operator.
        http://192.168.1.10:8111/docs/Expressions-%26-Variables/#new-operations-and-symbols

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

          That document pages says

          The C/C++ ternary operator <conditional-expression> ? <true-expr> : <false-expr> is supported. if <conditional-expression> then <true-expr> else <false-expr> is also supported as "syntactic sugar."

          But how to actually use it?

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

            Given that you have nothing in the ELSE, what does it matter? Very confusing...

            As you've shown it, this is just an Entity Attribute condition on power_switch.state, and a Request action in the Set reaction. Two rules, one for each switch.

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

              @toggledbits said in IF Else without LUA Code ?:

              Two rules, one for each switch.

              I'm not a coding expert as you can probably guess, I can just tinker and muddle through 😊

              I thought the Else was to End that portion of the script and then continue with the next thing in the script.

              This Lua script is very long. When motion is detected on my IP camera PLEG runs this Lua script and despite my lack of coding skills it all works.

              It checks all the Kodi PCs and FireTVs and if any are On and active, it sends a particular http command to them to display the cameras video stream.

              The code also sends particular Http commands to five different Android tablets running Tasker / TNES and TinyCam Pro, to display the cameras video stream.

              Different Http commands are sent to first wake up the tablets, then switch to TinyCam pro app, show camera image for 60 secs, switch back to the Home Remote Dashboard app and then put the tablets back to sleep, so it's sending out a lot of http commands with various delays in between.

              It also sends a Telegram message alert and TTS to Google Home.

              It does slightly different things with the tablets depending on if Vera is in home or Night mode also.

              So your saying I think, I'd need multiple rules each doing these different things, then all the rules being triggered off motion being detected on the IP camera (virtual motion sensor device in Vera) ?

              I was just wondering if I could do away with this Lua script and do it all in an MSR rule instead.

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

                No Lua seems to be required here, in either Vera Reactor or MSR, at least for what's described. The trickiest part is the HTTP requests, but both Reactors have a Request action that will do it. I don't think POST with payload has gotten a lot of use, but if it doesn't rise to occasion, you know I'll make sure it works.

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

                  Sending the HTTP requests out from a single MSR rule to the five Android tablets isn't the problem.

                  I have tested that and that part does work OK.

                  The problem is I don't know how to handle the Kodi PCs and FireTVs and "IF"

                  I will have to have an Entity Attribute to check the power state of each, as you said.

                  And IF any are turned On then send a particular http command to each of them to have them display the cameras video stream.

                  The problem was I couldn't see how to do that in one MSR rule.

                  But your suggesting I maybe able to do it by having multiple MSR rules all with the same trigger e.g. Motion has been detected.

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

                    @toggledbits

                    Another example I have just come across.

                    I have a basic schedule in PLEG that turns off my outdoor garden lights at 23:59 pm every day.

                    In that single PLEG action I also have this little bit of LUA Code:

                    local mode = luup.attr_get "Mode" 
                    if (mode == "1") then
                    luup.inet.wget("http://192.168.1.101:1880/scenetrigger?message=Schedule Turning Off Festoon Lights&ip=192.168.1.102")
                    else end
                    

                    IF Vera is in House Mode "HOME" (I am still awake or in the house) then it can send the HTTP Request / TTS announcement to the Google Home speaker via Node-Red.

                    However if the House Mode is something else other than "HOME" (I am either in bed already or not at home), then don't bother doing it.

                    I'm setting up this schedule in MSR now and in the "Set Reactions" I can't do this or I don't know how to do this, other than having this LUA code run actually on Vera still somehow.

                    I'd have to have two MSR Rules right ?

                    One that becomes TRUE when Vera is in HOME mode and then the HTTP Request is present in the "Set Reactions" actions area.

                    And another different rule that becomes TRUE for when Vera is NOT in HOME mode and no HTTP Request is even present in the "Set Reactions" actions area for that rule.

                    Thanks

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

                      Rule 1: time after 23:59; set reaction: turn off the garden lights
                      Rule 2: house mode == home AND Rule1 is true; set reaction: Request with URL

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

                        OK thanks. I really don't fancy having to create two rules or many more in the case of the IP camera thing, for a lot of this stuff, so I either just won't bother with the TTS at all or I'll try out @therealdb idea of adding my LUA code snippets in to the Vera startup and a Library function and using a local .lua file to store the code.

                        I can then call that particular LUA code via a HTTP command sent from the single MSR rule to Vera.

                        935923e2-8c5b-46ac-bfeb-0405982d150c-image.png

                        He tells us how to do it on this new Github page.

                        dbochicchio/vera

                        dbochicchio/vera

                        LUA Scripts for the eZlo Vera Platform (UI7). Contribute to dbochicchio/vera development by creating an account on GitHub.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Powered by NodeBB | Contributors
                        Hosted freely by PointPub Media Communications Inc. | Contact us