Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Unsolved
Collapse
Discussion Forum to share and further the development of home control and automation, independent of platforms.
  1. Home
  2. Software
  3. Multi-System Reactor
  4. HomeAsssistant Weather changed.... Global expression no longer functioning
Gradually turn on lights.
Tom_DT
I have several lights that I would like to turn on very gradually over 15 or 20 seconds. from 0 to .25 in .01 increments. I have tried a few things that came nowhere near working, so here I am.
Multi-System Reactor
Error After Upgrade
T
Topic thumbnail image
Multi-System Reactor
Reset attribute value of entity in event handler
R
Topic thumbnail image
Multi-System Reactor
Need help figuring out how to delay a reset on reaction
T
Topic thumbnail image
Multi-System Reactor
Way to search for rules (rule state) in other rules
T
@toggledbits, not sure if this is a feature request or I'm using the search tool wrong. You have a "Search for rule" in the Rules Set tab in MSR. It works nicely to find a rule and bring up said rule, but can it/could it be used for as a "where used?" global search? For instance, I have a fairly large set of rules, divided up into 10 different rulesets. There's easily a hundred individual rules, and many of the rules have Rule State triggers, which of course refer to other rules. Amongst my troubleshooting today, I came across what may have been a duplicate or troubleshooting attempt, but I can't tell if it's actually used as a Rule State in another rule without opening each rule that I suspect it may be a part of. Thanks.
Multi-System Reactor
Links to MSR from HA
Tom_DT
I am using Home Assistant a lot recently. On a dashboard showing the devices, I would like to show a link to the MSR rule that controls the devices. Is there a way to link directly into MSR?
Multi-System Reactor
Set Reaction > Script Action
wmarcolinW
Topic thumbnail image
Multi-System Reactor
Errors after updating to MQTTController build 25139
tunnusT
I'm running MSR build 25139 on Docker, using MQTT controller 24293, and everything working as expected. But if I try to upgrade to MQTTController build 25139, I'm getting the following errors on MSR UI: An Entity Attribute condition in "Lay-Z-Spa auto heating off" (Terrace) failed because the referenced entity "Lay-Z-Spa States" (mqtt>layzspa_states) does not have attribute value_sensor.god Last 11:20:37 An Entity Attribute condition in "Lay-Z-Spa auto heating off" (Terrace) failed because the referenced entity "Lay-Z-Spa States" (mqtt>layzspa_states) does not have attribute temperature_sensor.green Last 11:20:37 An Entity Attribute condition in "Lay-Z-Spa filter pump auto off" (Terrace) failed because the referenced entity "Lay-Z-Spa States" (mqtt>layzspa_states) does not have attribute temperature_sensor.red Last 11:20:37 An Entity Attribute condition in "Lay-Z-Spa filter pump auto run" (Terrace) failed because the referenced entity "Lay-Z-Spa States" (mqtt>layzspa_states) does not have attribute value_sensor.pump Last 11:20:37 An Entity Attribute condition in "Lay-Z-Spa watchdog" (Terrace) failed because the referenced entity "Lay-Z-Spa States" (mqtt>layzspa_states) does not have attribute value_sensor.status Last 11:20:37 My MQTT configuration (local_mqtt_devices.yaml) for the related entity is: layzspa_message: type: ValueSensor capabilities: ["temperature_sensor", "value_sensor", "power_sensor"] primary_attribute: power_sensor.value events: "layzspa/message": "power_sensor.value": json_payload: true if_expr: '! isnull( payload?.PWR )' expr: "float(payload.PWR)" "value_sensor.air": json_payload: true if_expr: '! isnull( payload?.AIR )' expr: "float(payload.AIR)" "value_sensor.pump": json_payload: true if_expr: '! isnull( payload?.FLT )' expr: "float(payload.FLT)" "value_sensor.god": json_payload: true if_expr: '! isnull( payload?.GOD )' expr: "float(payload.GOD)" "value_sensor.lock": json_payload: true if_expr: '! isnull( payload?.LCK )' expr: "float(payload.LCK)" "value_sensor.unit": json_payload: true if_expr: '! isnull( payload?.UNT )' expr: "float(payload.UNT)" "value_sensor.error": json_payload: true if_expr: '! isnull( payload?.ERR )' expr: "float(payload.ERR)" "temperature_sensor.green": json_payload: true if_expr: '! isnull( payload?.GRN )' expr: "float(payload.GRN)" "temperature_sensor.red": json_payload: true if_expr: '! isnull( payload?.RED )' expr: "float(payload.RED)" "temperature_sensor.target": json_payload: true if_expr: '! isnull( payload?.TGT )' expr: "float(payload.TGT)" "temperature_sensor.value": json_payload: true if_expr: '! isnull( payload?.TMP )' expr: "float(payload.TMP)" "temperature_sensor.virtual": json_payload: true if_expr: '! isnull( payload?.VTM )' expr: "round(float(payload.VTM), 1)" "temperature_sensor.ambient": json_payload: true if_expr: '! isnull( payload?.AMB )' expr: "float(payload.AMB)" "layzspa/Status": "value_sensor.status": if_expr: '! isnull( payload )' expr: "payload" "layzspa/button": "value_sensor.button": if_expr: '! isnull( payload )' expr: "payload" and in reactor.yaml I have: "layzspa_states": name: "Lay-Z-Spa States" friendly_name: 'Lay-Z-Spa States' include: layzspa_message I realize my MQTT configuration might be a bit unorthodox, but could there still be something unintentional in the latest MQTTController build? If needed, I can provide detailed logs.
Multi-System Reactor
🎉 My very first MSR controller: OpenSprinkler
therealdbT
Since today is my birthday - and I still pretend to be unconventional - I'm giving away a present to this wonderful community and I'm releasing my first OpenSprinkler controller for MSR. It was real fun to code it - and while it's still WIP, it seems to work OK for me. It's polling-based at the moment, but I'll add support for updates via MQTT very soon (it's already partially coded). Get it at (install is similar to MQTTController and such): https://github.com/dbochicchio/reactor-opensprinkler Feel free to try it. It's beta software, but it's stable. I'll update it weekly until all the tasks from my todo list are empty. Since I've learnt a lot from this controller, I'll explore new controllers soon.
Multi-System Reactor
Advice reqeusted to migrate MSR from Bare Metal to Container
T
Good day all, I'm in the process of trying to shut down my 10 year old Linux home server that served many purposes, but primarily it's what I used for my NAS/Plex Media server. I migrated the NAS aspect of the server in November of last year to a true NAS solution (Ubiquti UNAS Pro), which is rack mount and much more efficient than my old tower, which it's only side benefit was heating my home office during the winter. Unfortunately it also means heating my home office during the summer, which were about to be in full swing. I have two things running on this 10 year old server at this point. MSR and pi-hole. I'm running Plex Media Server on Fedora Workstation in Podman on mini PC, which is much more energy efficient than my old tower. My next step is to migrate MSR. I know there are images of MSR out there, and creating it is well documented. I'm going to be using Podman instead of Docker for various reasons, but they work very similar. What I don't know, is what I need to do to migrate my existing Bare Metal installation over to a container. Has anyone done this? Any advice?
Multi-System Reactor
Reactor (Multi-System/Multi-Hub) Announcements
toggledbitsT
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
Can´t restart or upgrade/deploy MSR
F
Topic thumbnail image
Multi-System Reactor
[Solved] Limit HA Entity in MSR
wmarcolinW
Topic thumbnail image
Multi-System Reactor
Organizing/ structuring rule sets and rules
R
Hi guys, Just wondering how you guys organize your rule sets and rules. I wish I had an extra layer to have some more granularity, but my feature request was not popular. Maybe there are better ways to organize my rule sets. I use the rule sets now primarily for rooms. So a rule set per room. But maybe grouping by functionality works better. Any examples/ suggestions would be appreciated.
Multi-System Reactor
Moving MSR from a QNAP container to RP 5 - some issues
Tom_DT
Topic thumbnail image
Multi-System Reactor
Widget deletion does not work and landing page (status) is empy
M
Topic thumbnail image
Multi-System Reactor
Need help reducing false positive notifications
T
Topic thumbnail image
Multi-System Reactor
Deleting widgets
tunnusT
Hopefully a trivial question, but how do you delete widgets in a status page? Using build 22266
Multi-System Reactor
MQTT configuration question
tunnusT
I have the following yaml configuration in local_mqtt_devices file x_mqtt_device: set_speed: arguments: speed: type: str topic: "command/%friendly_name%" payload: type: json expr: '{ "fan": parameters.speed }' While this works fine, I'm wondering how this could be changed to "fixed" parameters, as in this case "fan" only accepts "A", "Q" or a numeric value of 1-5?
Multi-System Reactor
System Configuration Check - time is offset
F
Hi! I get this message when I'm on the status tab: System Configuration Check The time on this system and on the Reactor host are significantly different. This may be due to incorrect system configuration on either or both. Please check the configuration of both systems. The host reports 2025-04-01T15:29:29.252Z; browser reports 2025-04-01T15:29:40.528Z; difference 11.276 seconds. I have MSR installed as a docker on my Home Assistant Blue / Hardkernel ODROID-N2/N2+. MSR version is latest-25082-3c348de6. HA versions are: Core 2025.3.4 Supervisor 2025.03.4 Operating System 15.1 I have restarted HA as well as MSR multiple times. This message didn´t show two weeks ago. Don´t know if it have anything to do with the latest MSR version. Do anyone know what I can try? Thanks in advance! Let's Be Careful Out There (Hill Street reference...) /Fanan
Multi-System Reactor

HomeAsssistant Weather changed.... Global expression no longer functioning

Scheduled Pinned Locked Moved Multi-System Reactor
16 Posts 4 Posters 2.1k Views 4 Watching
  • 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.
  • T Offline
    T Offline
    tamorgen
    wrote on last edited by
    #1

    Good morning,
    So Home Assistant decided to change the default weather home format that I've been using for the past year and a half. I had two Global Expressions set up to pull the high and low temp forecast for the day. Now it's pulling null values.

    094c9205-cc9e-4fcc-ac4f-1bf54acea299-image.png

    In the dev tools, it now uses a new service (Weather. get forecasts), plural, where the old Weather.get forecast is depreciated and now longer functions.

    8c7a1fcc-dd3f-4268-a0b7-29d542f86adc-image.png

    It shows a templow field, and a temperature field, which I presume is the forecast high.

    When I head back over to MSR, I'm having a hard time finding those values in the Entities tab.

    c5ea1048-a72e-4647-9c50-9d0c5fd20767-image.png

    wx.asoftime=null
    wx.ceiling=null
    wx.ceiling_unit=null
    wx.cloud_cover=null
    wx.condition_code=null
    wx.description="partlycloudy"
    wx.feels_like=null
    wx.humidity=57
    wx.humidity_unit="%"
    wx.icon=null
    wx.location=null
    wx.precipitation_1hr=null
    wx.precipitation_24hr=null
    wx.precipitation_other=null
    wx.precipitation_type=null
    wx.precipitation_unit="in"
    wx.pressure=30
    wx.pressure_unit="inHg"
    wx.temperature=55
    wx.temperature_unit="°F"
    wx.visibility=null
    wx.visibility_unit="mi"
    wx.wind_compass=210.3
    wx.wind_conditions=null
    wx.wind_direction="SSW"
    wx.wind_gust=null
    wx.wind_speed=6.28
    wx.wind_speed_unit="mph"
    x_hass.domain="weather"
    x_hass.entity_id="weather.forecast_home"
    x_hass.services=["weather"]
    x_hass.state="partlycloudy"
    x_hass_attr.attribution="Weather forecast from met.no, delivered by the Norwegian Meteorological Institute."
    x_hass_attr.cloud_coverage=85.9
    x_hass_attr.dew_point=40
    x_hass_attr.friendly_name="New Windsor Weather"
    x_hass_attr.humidity=57
    x_hass_attr.precipitation_unit="in"
    x_hass_attr.pressure=30
    x_hass_attr.pressure_unit="inHg"
    x_hass_attr.supported_features=3
    x_hass_attr.temperature=55
    x_hass_attr.temperature_unit="°F"
    x_hass_attr.visibility_unit="mi"
    x_hass_attr.wind_bearing=210.3
    x_hass_attr.wind_speed=6.28
    x_hass_attr.wind_speed_unit="mph"
    

    There is a x_hass_attr.temperature, but that appears to be the current temperature, not the high that I found on the dev tools screenshot.

    Any ideas?

    Running:

    Core
    2024.4.3
    Supervisor
    2024.04.0
    Operating System
    12.2
    Frontend
    20240404.2

    MSR: latest-24057-e9add9f5

    1 Reply Last reply
    0
    • toggledbitsT Offline
      toggledbitsT Offline
      toggledbits
      wrote on last edited by toggledbits
      #2

      Chalk it up to Home Assistant's legacy of breaking changes. The whole matter of service calls being able to return data came about in 2023.7 but didn't work until 2023.12 for the websocket API, and didn't apply to anything anyone seemed to care about until now. So current Reactor doesn't store that response anywhere, and in fact doesn't know to ask for it, and the service you're calling requires it, so you're probably getting an error in the log that you haven't spotted (always look at the logs when things don't work as expected!).

      Until I get a fix for this into HassController, the only remedy right now is to downgrade your Hass back to 2024.3 or earlier.

      P.S. This is why I say in the documentation and have HassController complain bitterly when you're running a Hass version that isn't yet supported/verified. I assume you got a warning about that, too.

      74fbb817-75f3-47ce-b948-fb3ef1afefb1-image.png

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

      T 1 Reply Last reply
      0
      • toggledbitsT toggledbits

        Chalk it up to Home Assistant's legacy of breaking changes. The whole matter of service calls being able to return data came about in 2023.7 but didn't work until 2023.12 for the websocket API, and didn't apply to anything anyone seemed to care about until now. So current Reactor doesn't store that response anywhere, and in fact doesn't know to ask for it, and the service you're calling requires it, so you're probably getting an error in the log that you haven't spotted (always look at the logs when things don't work as expected!).

        Until I get a fix for this into HassController, the only remedy right now is to downgrade your Hass back to 2024.3 or earlier.

        P.S. This is why I say in the documentation and have HassController complain bitterly when you're running a Hass version that isn't yet supported/verified. I assume you got a warning about that, too.

        74fbb817-75f3-47ce-b948-fb3ef1afefb1-image.png

        T Offline
        T Offline
        tamorgen
        wrote on last edited by
        #3

        @toggledbits said in HomeAsssistant Weather changed.... Global expression no longer functioning:

        Chalk it up to Home Assistant's legacy of breaking changes. The whole matter of service calls being able to return data came about in 2023.7 but didn't work until 2023.12 for the websocket API, and didn't apply to anything anyone seemed to care about until now. So current Reactor doesn't store that response anywhere, and in fact doesn't know to ask for it, and the service you're calling requires it, so you're probably getting an error in the log that you haven't spotted (always look at the logs when things don't work as expected!).

        Until I get a fix for this into HassController, the only remedy right now is to downgrade your Hass back to 2024.3 or earlier.

        P.S. This is why I say in the documentation and have HassController complain bitterly when you're running a Hass version that isn't yet supported/verified. I assume you got a warning about that, too.

        74fbb817-75f3-47ce-b948-fb3ef1afefb1-image.png

        Thanks Patrick, that's pretty much what I had figured. It wouldn't be the first time that HAAS has changed something 6 months ago and broke my setup.

        I did see the notice yes, however, I think there was another notice I got from HAAS that told me if I didn't upgrade that something else would stop functioning. Always a balancing act unfortunatley.

        Let me know when you come out with a version of HaasController that addresses this, and I'll gladly test it out for you.

        1 Reply Last reply
        0
        • therealdbT Offline
          therealdbT Offline
          therealdb
          wrote on last edited by
          #4

          I had the same problem and moved to a rule with openweathermap.

          I capture the response in a global variable and use it in my automation. I even have a couple of virtual devices to remap it. Less dependent on HASS and OWM has better forecast for me. Free API keys if you make two separate calls for current and forecast.

          --
          On a mission to automate everything.

          My MS Reactor contrib
          My Luup Plug-ins

          T 1 Reply Last reply
          0
          • therealdbT therealdb

            I had the same problem and moved to a rule with openweathermap.

            I capture the response in a global variable and use it in my automation. I even have a couple of virtual devices to remap it. Less dependent on HASS and OWM has better forecast for me. Free API keys if you make two separate calls for current and forecast.

            T Offline
            T Offline
            tamorgen
            wrote on last edited by
            #5

            @therealdb said in HomeAsssistant Weather changed.... Global expression no longer functioning:

            I had the same problem and moved to a rule with openweathermap.

            I capture the response in a global variable and use it in my automation. I even have a couple of virtual devices to remap it. Less dependent on HASS and OWM has better forecast for me. Free API keys if you make two separate calls for current and forecast.

            I tried that, and you're right, in theory it should work, however, OWM shows "null" for forecast low for me.

            f2b29fc4-d246-4549-8fda-7f3802e1e50c-image.png

            therealdbT 1 Reply Last reply
            0
            • toggledbitsT Offline
              toggledbitsT Offline
              toggledbits
              wrote on last edited by
              #6

              @tamorgen are you installed bare-metal, or running in docker?

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

              T 1 Reply Last reply
              0
              • G Offline
                G Offline
                gwp1
                wrote on last edited by
                #7

                @tamorgen I've used OWM and VisualCrossing as well as pulling data in via local API from my Ambient and Tempest weather arrays in the backyard.

                OWM is currently in the middle of changing to v3.0 of their All-in-One API, fyi. This may/may not affect you.

                *Hubitat C-7 2.4.1.177
                *Proxmox VE v8, Beelink MiniPC 12GBs, SSD

                *HASS 2025.6.0
                w/ ZST10-700 fw 7.18.3

                *Prod MSR in docker/portainer
                MSR: latest-25139-fbd67abc
                MQTTController: 25139
                ZWave Controller: 25139

                1 Reply Last reply
                0
                • toggledbitsT Offline
                  toggledbitsT Offline
                  toggledbits
                  wrote on last edited by
                  #8

                  Service responses are addressed in build 24115 (just released)

                  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
                  0
                  • T tamorgen

                    @therealdb said in HomeAsssistant Weather changed.... Global expression no longer functioning:

                    I had the same problem and moved to a rule with openweathermap.

                    I capture the response in a global variable and use it in my automation. I even have a couple of virtual devices to remap it. Less dependent on HASS and OWM has better forecast for me. Free API keys if you make two separate calls for current and forecast.

                    I tried that, and you're right, in theory it should work, however, OWM shows "null" for forecast low for me.

                    f2b29fc4-d246-4549-8fda-7f3802e1e50c-image.png

                    therealdbT Offline
                    therealdbT Offline
                    therealdb
                    wrote on last edited by therealdb
                    #9

                    @tamorgen try cnt param or similar to limit the response size.

                    --
                    On a mission to automate everything.

                    My MS Reactor contrib
                    My Luup Plug-ins

                    therealdbT 1 Reply Last reply
                    0
                    • therealdbT therealdb

                      @tamorgen try cnt param or similar to limit the response size.

                      therealdbT Offline
                      therealdbT Offline
                      therealdb
                      wrote on last edited by therealdb
                      #10

                      it's cnt. Since I just want the next forecast, I'm limiting it to 5.

                      https://api.openweathermap.org/data/2.5/forecast?lat=X&lon=X&units=metric&appid=X&lang=en&cnt=5

                      @gwp1 is right, but if you don't want to use onecall (very helpful to be honest) and want to make two calls, you'll be good with the free one. As I said, I just want forecast (for cloud, rain and min/max temp), so it's just one call for me.

                      Initially I wanted to make a dedicated controller for OWM (using the native weather station capability), but it's just one call, so it's easier this way.

                      --
                      On a mission to automate everything.

                      My MS Reactor contrib
                      My Luup Plug-ins

                      1 Reply Last reply
                      0
                      • toggledbitsT toggledbits

                        @tamorgen are you installed bare-metal, or running in docker?

                        T Offline
                        T Offline
                        tamorgen
                        wrote on last edited by
                        #11

                        @toggledbits

                        I'm installed bare-metal.

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          tamorgen
                          wrote on last edited by tamorgen
                          #12

                          So it does appear to call the service now. Now I have to figure out how to get it into my expression.

                          This output was from going into the Entities tab, and running the service manually. If I want to get the forecast and get the high/low temps, will i need to run an action daily to call the service, or will the expression do it for me? I don't see any documentation yet on the Reactor installation instructions for Service responses.

                          wx.asoftime=null
                          wx.ceiling=null
                          wx.ceiling_unit=null
                          wx.cloud_cover=null
                          wx.condition_code=null
                          wx.description="cloudy"
                          wx.feels_like=null
                          wx.humidity=60
                          wx.humidity_unit="%"
                          wx.icon=null
                          wx.location=null
                          wx.precipitation_1hr=null
                          wx.precipitation_24hr=null
                          wx.precipitation_other=null
                          wx.precipitation_type=null
                          wx.precipitation_unit="in"
                          wx.pressure=30.26
                          wx.pressure_unit="inHg"
                          wx.temperature=41
                          wx.temperature_unit="°F"
                          wx.visibility=null
                          wx.visibility_unit="mi"
                          wx.wind_compass=13.7
                          wx.wind_conditions=null
                          wx.wind_direction="N"
                          wx.wind_gust=null
                          wx.wind_speed=8.26
                          wx.wind_speed_unit="mph"
                          x_hass.domain="weather"
                          x_hass.entity_id="weather.forecast_home"
                          x_hass.services=["weather"]
                          x_hass.state="cloudy"
                          x_hass_attr.attribution="Weather forecast from met.no, delivered by the Norwegian Meteorological Institute."
                          x_hass_attr.cloud_coverage=89.8
                          x_hass_attr.dew_point=28
                          x_hass_attr.friendly_name="New Windsor Weather"
                          x_hass_attr.humidity=60
                          x_hass_attr.precipitation_unit="in"
                          x_hass_attr.pressure=30.26
                          x_hass_attr.pressure_unit="inHg"
                          x_hass_attr.supported_features=3
                          x_hass_attr.temperature=41
                          x_hass_attr.temperature_unit="°F"
                          x_hass_attr.visibility_unit="mi"
                          x_hass_attr.wind_bearing=13.7
                          x_hass_attr.wind_speed=8.26
                          x_hass_attr.wind_speed_unit="mph"
                          x_hass.last_response={"service":"weather.get_forecasts","since":1714043894115,"response":{"weather.forecast_home":{"forecast":[{"condition":"partlycloudy","datetime":"2024-04-25T16:00:00+00:00","wind_bearing":24,"temperature":57,"templow":41,"wind_speed":8.26,"precipitation":0,"humidity":51},{"condition":"sunny","datetime":"2024-04-26T16:00:00+00:00","wind_bearing":130.1,"temperature":61,"templow":41,"wind_speed":10.5,"precipitation":0,"humidity":30},{"condition":"cloudy","datetime":"2024-04-27T16:00:00+00:00","wind_bearing":142.8,"temperature":56,"templow":42,"wind_speed":10.31,"precipitation":0,"humidity":59},{"condition":"sunny","datetime":"2024-04-28T16:00:00+00:00","wind_bearing":234.2,"temperature":78,"templow":47,"wind_speed":7.15,"precipitation":0,"humidity":49},{"condition":"partlycloudy","datetime":"2024-04-29T16:00:00+00:00","wind_bearing":239.6,"temperature":86,"templow":62,"wind_speed":6.28,"precipitation":0,"humidity":42},{"condition":"cloudy","datetime":"2024-04-30T16:00:00+00:00","wind_bearing":257.4,"temperature":85,"templow":67,"wind_speed":8.08,"precipitation":0.02,"humidity":39}]}}}

                          My call was for daily, so it shows a forecast for 5 days. Somehow I need to distinguish just today's forecast.

                          1 Reply Last reply
                          0
                          • toggledbitsT Offline
                            toggledbitsT Offline
                            toggledbits
                            wrote on last edited by toggledbits
                            #13

                            The response is stored on the target Reactor entity (that's entity from which you make the service call, unless you are using call_service from the system entity, in which case you have to specify a target). The x_hass.last_response attribute is used to store the returned response. It is not processed in any way, it is stored as it is received (so it will always be a string).

                            I think the rest of the work is pretty much the same as how you'd handle a response from an HTTP request, and you've probably done it all before, but I'll spell it out for the benefit of other future readers.

                            If you copy-paste the response into a beautifier like jsonlint.com it will pretty-print the object so it's easier to discern its structure. The forecast lives in an array called forecast, and the array seems to have the current day's forecast as the first element (i.e. it's sorted by date, ascending). An unfortunate choice on the API's part is that they chose to name a key in their response weather.forecast_home — the dot in the key name will make it just a little harder to navigate through the object, because dot is a special syntax character in the expression language for accessing elements in object. We'll have to use an alternate syntax, which I'll illustrate with the example expression below that brings everything together up to this point. I break it into two parts to keep it more readable and easy to follow:

                            r = getEntity( 'entity-canonical-id' ).attributes.x_hass.last_response,
                            forecast_today = r.response['weather.forecast_home'].forecast[0]
                            

                            Although this is two lines, it is implemented in one (probably global) expression. In the first line, we use an expression local variable r to fetch the response data from the entity. In the second line, we traverse the data in r to get to the forecast data. We use ['name'] syntax instead of .name syntax to access the property with key weather.forecast_home. The [0] at the end simply gets the first element (they are numbered from 0 in our expression language) of the forecast array.

                            At this point, the expression result would be an object containing the first forecast. You can add a further line to this expression to return one value from the forecast if you only need one, or create multiple new expressions that use the result of this expression if you need more than one value.

                            condition = forecast_today.condition
                            templow = forecast_today.tempLow
                            

                            Overall, I'd make one rule to periodically call the service and fetch the weather, with whatever frequency suits you (i.e. it only does the fetch). I'd make forecast_today above a global expression. The parts of the forecast you need could be drawn out from forecast_today using other global expressions or in rule expressions. When the query rule causes an update to x_hass.last_response, the engine will re-evaluate the forecast_today expression to parse the result to the single forecast object. Other expression evaluations will be triggered by a change in that object, and that, of course, will cause evaluation of rules' triggers that involve those variables.

                            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
                            0
                            • T Offline
                              T Offline
                              tamorgen
                              wrote on last edited by
                              #14

                              Looks like I may be missing something....

                              I tried it as you showed it, putting my cannonical ID in place.

                              Screenshot 2024-04-25 at 8.39.19 AM.png

                              It's giving me a response error "Last value: (error) Unexpected token o in JSON at position 1"

                              I then tried splitting up the lines, but that doesn't seem to work either.

                              Screenshot 2024-04-25 at 8.37.46 AM.png

                              It's giving me an error about an unexpected token o in JSON at position 1 as well, however, for the second one, it gives me "Last value: (error) Invalid scope in reference to member response of (object)null". I suspect the first method is the correct one, but I must have something incorrect in the format.

                              1 Reply Last reply
                              0
                              • toggledbitsT Offline
                                toggledbitsT Offline
                                toggledbits
                                wrote on last edited by toggledbits
                                #15

                                My bad. Looks like it does return a real object, and it doesn't need to be parsed. Remove the parseJSON() call. I'll fix up the earlier post.

                                14ab4120-0a8a-44ce-a21c-cf90d2faf8f8-image.png

                                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
                                0
                                • T Offline
                                  T Offline
                                  tamorgen
                                  wrote on last edited by
                                  #16

                                  Awesome, that did the trick!

                                  Screenshot 2024-04-25 at 9.31.15 AM.png

                                  1 Reply Last reply
                                  0
                                  • toggledbitsT toggledbits locked this topic on
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  Recent Topics

                                  • Gradually turn on lights.
                                    toggledbitsT
                                    toggledbits
                                    0
                                    2
                                    26

                                  • Error After Upgrade
                                    G
                                    gwp1
                                    0
                                    4
                                    35

                                  • Reset attribute value of entity in event handler
                                    R
                                    RHCPNG
                                    0
                                    5
                                    112

                                  • Need help figuring out how to delay a reset on reaction
                                    G
                                    gwp1
                                    0
                                    22
                                    342

                                  • Way to search for rules (rule state) in other rules
                                    T
                                    tamorgen
                                    0
                                    3
                                    59

                                  • Links to MSR from HA
                                    Tom_DT
                                    Tom_D
                                    0
                                    1
                                    58

                                  • Set Reaction > Script Action
                                    wmarcolinW
                                    wmarcolin
                                    0
                                    11
                                    347

                                  • Wiring Samotech SM308-S into light fitting
                                    akbooerA
                                    akbooer
                                    0
                                    2
                                    111

                                  • Errors after updating to MQTTController build 25139
                                    toggledbitsT
                                    toggledbits
                                    0
                                    6
                                    201

                                  • 🎉 My very first MSR controller: OpenSprinkler
                                    therealdbT
                                    therealdb
                                    5
                                    13
                                    823

                                  • Advice reqeusted to migrate MSR from Bare Metal to Container
                                    T
                                    tamorgen
                                    0
                                    5
                                    211

                                  • Reactor (Multi-System/Multi-Hub) Announcements
                                    toggledbitsT
                                    toggledbits
                                    5
                                    122
                                    48.7k
                                  Powered by NodeBB | Contributors
                                  Hosted freely by 10RUPTiV - Solutions Technologiques | Contact us
                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Unsolved