How do I capture state information about a device?

So say I want to grab the current state of a device, make it simple let’s say a smart bulb, I want to get the current state of it, brightness, color, on/off, whatever, and put those parameters into variables so I can clone them to another smart bulb. How would I do that?

I was doing that sort of thing a lot in WebCoRE before it bit it. Now I want to do that same sort of thing in Home Assistant and now that I am starting to finally write automatons in HA I am lost as to how to do that in this platform. Took me a while to figure it out in WebCoRE, now it’s a whole new starting point.

What is your end use case?

If you just want the two lights to always have the same settings put them in a light group helper and use that in your automations instead of the two individual lights.

Well I have a lot of different end cases, that was a simplistic example.

Example 1:
There is a light, it’s state can be anything, maybe it is in some state dictated by a scene, or a voice command, or maybe it’s not even on. Maybe it’s a group of lights, or there is a switch involved. Regardless, there is a closet near that light, and when I open that closet that light should go bright to illuminate the closet. When I close the closet it all goes back to the state it was, whatever it was, it doesn’t matter. Also applicable to stuff like garage lights or maybe just room presence in general. If there is no one in the room go dark, turn off the TV, etc, but when I go into the room or maybe near that room it’s exactly how I left it. Kind of a whole room screen saver.

Example 2:
I have a smart thermostat and I have a WiFi connected AC/Heat Pump mini split. There is no physical connection between the 2, but both are in HA. The thermostat isn’t actually physically connected to anything except a C-Wire power source. I would like to treat these as if they are connected, which they are really via Home Assistant. I can read or trigger off of any number of things from the thermostat; Set Temperature changes, Measured Temperature, Humidity, Mode, Room Presence and I can change anything on the mini split. I want an automation that when I physically (or logically) change something on the thermostat it gets sent to the mini split.

Before I bit the bullet on HA I was doing this sort of thing in WeBCoRE with SmartThings, well the first case at least, the house wide commitment to mini splits has happened since. But I also have added WiFi dehumidifiers, fans and air quality sensors which I’d like to similarly integrate with Smart HEPA filters. So not a single use case but a bunch of them.

In Home Assistant, that scenario is usually handled by creating and restoring a snapshot scene.

Creating a scene on the fly.

Global variables aren’t needed to fulfill that requirement.

This looks like that would probably work for the first example

OK, wasn’t suggesting it did, or frankly didn’t even know of such a thing, although it’s certainly interesting.

I just want to take something like grabbing the set temperature from climate.office_ecobee if it’s changed and plug it into climate.office_ac_b temperature. Or the mode maybe. Although one of the issues I always had with the ecobee was the required slop between AC setting and Heat setting in Auto, which I’d really rather dictate based on outside weather conditions.

You had suggested it in your first post.

For the record, Home Assistant doesn’t have a native implementation of global variables.

For the thermostat automation, you would use State Triggers to detect one thermostat’s changes and then pass them on to the other thermostat via service calls.

gotcha, was thinking in WebCoRE terms where variables and global variables are distinct from each other.

I looked at that link to service calls, but still unsure of how I would take the value from one entity and plug it into another. I can trigger based on if a value changes, fair enough, but now I want to use the value somewhere else. Seems like the dynamic scene may be the way to do that, as I know that is a way to set the climate entities. Just still unclear how I would populate that.

State Trigger - Template Variables


alias: rough example
  - id: 'hvac_mode'
    platform: state
    entity_id: climate.thermostat1
  - id: 'temperature'
    platform: state
    entity_id: climate.thermostat1
    attribute: temperature
condition: []
  - choose:
      - conditions: "{{ == 'temperature' }}"
          - service: climate.set_temperature
              entity_id: climate.thermostat2
              temperature:  "{{ trigger.to_state.attributes.temperature }}"
      - conditions: "{{ == 'hvac_mode' }}"
          - service: climate.set_hvac_mode
              entity_id: climate.thermostat2
              hvac_mode: "{{ trigger.to_state.state }}"
    default: []

Awesome, works…kinda, sorta…I changed it a bit to simplify it, Just triggered temp change, condition trigger, one action; call service. Didn’t look like it was working, but apparently just painfully slow, like 10 minutes. Then got rid of the named id and the condition and that took it down to 3 minutes, still slow, but better.

So not sure if the original version worked or not, I didn’t have the patients and what I really care about is setting the temp in one place and having it change in another. I really do appreciate the help on this, I knew it had to be possible. It’s a pretty simple thing. Anyway, now the fun part, installing an ecobee in every room.

I’ll also be doing some of those dynamic scenes, so I can feel like I just leave everything on, but behind the scenes HA is turning everything off behind me.

Can you tell me more about about how you’re doing that?

My understanding is that an Ecobee thermostat is designed to directly control a central HVAC system (furnace/AC/heat pump). How are you making multiple Ecobee thermostats control the same equipment?

LOL, I’m not, my house had 2 furnaces and 2 central ACs one of the ACs died, and everything left was really old and inefficient. So in a fit of madness I tore it all out and replaced it with 20 mini splits, 4 each on 5 compressors. It’s kinda crazy, but despite my new massive capacity I was using 30% less power at the height of a Georgia summer than I was in January on the old system. The mini splits do both the AC and the heat. They are also very localized, so I can have rooms next to each other quite a few degrees different in temperature. Oh and they’re all connected via WiFi and using the LG ThinQ integration. Now that the weather is changing I’m starting to automate them, as that was the goal to all this, a completely zoned house.

So I had ecobees before on the old system, and had one that an AC guy fried, although it still worked just wouldn’t control anything directly. I had it in my office and basically just used it as a status display. Figured out how to get an ecobee to be that way on purpose, which isn’t that hard actually, just jump a couple wires so it thinks it’s connected to something. Anyway the remotes for the mini splits are not ideal, they independently set themselves and the AC to what it thinks are the same thing but in practice they get out of sync, and if you change something in an automation and try to use the remote it resets the AC to what it thinks is it’s last state. So every room will get an ecobee as kind of an AC/Heat specific dashboard. Also a notification source for Alexa since every room also has a FireTV cube which has it’s own flaw in that, while it acts like an echo in most every way and then some, what it doesn’t do is show you a visual indication of notifications like an echo does. Also ecobees have the remote sensor stuff and yada yada, so, for me, pretty perfect dashboard as everything else I really care about can just be completely automated or more easily voice controlled.

So at the end of the day if I want to bump the temp up or down a degree or so, or just see what the current temp is there is a little pretty box on the wall that does exactly that, and was made to do exactly that. I’m just hacking it a bit to do exactly that, not exactly as intended.

Oh and I laid out the mini split system so that I can have one completely die and It doesn’t really matter. The more critical rooms have multiple mini splits in them, which also allows me during transitional weather to have portions of the house heated and portions cooled or even off simultaneously. Each compressor can do one or the other but not both really, at least not efficiently. Hence the comment about using outside weather to dictate what mode things are in. Anyway this’ll also allow me to do pretty precise climate control to the same temp whether heating or cooling, something the ecobees cannot do connected to a traditional system, they put several degrees of slop between heat target and cool target so that they don’t ping pong, but that’s easy enough to solve with automation.