[ST Edge] Capability that receives values from external device/source

To implement virtual thermostat, it is required to receive temperature/humidity readings from external source (physical device/sensor).
My question is how possibly it can be done?
The standard temperature capability that is used in sensors can be used as an automation trigger. However, the ‘IF’ condition in automation for this capability can be only ‘Matches’, ‘Equal or above’ or ‘Equal or below’. What I’m missing is something like ‘Changes’ condition, that is fired anytime the value has been changed.
In addition, the value of the temperature capability of the physical sensor needs to be copied into the value of the virtual thermostat. How that could be achieved?

So, basically there are 2 questions:

  1. How it is possible to create an automation, based on arbitrary change of some capability value?
  2. How it is possible to propagate/copy this new/changed value to another capability?


A ‘virtual thermostat’ device would represent the controls and display of a thermostat, be it a real or virtual one. So it is more accurately a virtual thermostat controller.

An actual ‘virtual thermostat’ would be an automation that simulates the electronics or firmware of a real thermostat, taking inputs from temperature sensor devices, sending commands to heating and cooling devices, and using a virtual thermostat controller device for the user interface.

That’s beyond Automations and currently beyond Rules. It is really custom app territory (yes, you could do it with e.g. webCoRE but that is a custom app).

1 Like

Thank you for your answer.
I’m trying to understand whether it is possible to avoid custom app.
I think all controlling logic can be fairly easily implemented inside the virtual device driver. Basically, the device needs to check the selected thermostat mode and then based on the selected mode, sensors measurements and cooling/heating setpoints calculate the operating state. The same can be probably done for fan control.

Controlling switches can be achieved with automation, based on thermostat’s calculated operating state. Again, the state can be calculated, based on thermostat mode and temperature/humidity measurements or we can have 2 separate states one for cooling/heating and another for fans.
If this is not sufficient or too complicated, it is possible to add several switch capabilities to the thermostat, for heating, cooling and fan. However, those switch capabilities should still be connected to the real switches with automation. Therefore, I don’t see a real benefits for adding switch capabilities, but I’m open to further discuss it.

The only problem I can see is how to provide the readings from one or more physical sensors to another device.

1 Like

I agree. It is a thing that Rules can’t help with yet and I think it is the stopper.

We really need the fully featured Rules API and we need it yesterday.

I’m curious about both questions. Can you share more details, please?

  1. Do you want to create an Edge driver that controls multiple devices?
  • I’ve seen other developers configure a main device (like a Raspberry Pi) that receives information from other devices and controls them. This depends on how you set the physical configuration to communicate with them.
  • Up to now, you cannot control devices outside the driver, this means other devices that are installed in your account.
  1. The things you need to consider to integrate a device are:
  • Type of device > Zigbee, Z-Wave, LAN, cloud-integrated, etc. This will help you select the best option to integrate it.
  • Which capabilities does it use and check if the standard capabilities work for you (remember that you can change the available enums and value range through the device-config)

For the automation where you require getting all value changes, you can create a Subscription with a SmartApp. If your device can be cloud-integrated, you could integrate it and create the subscription in the SmartApp Connector.

1 Like


Thank you so much for your replay.

Consider the following scenario.
I have a temperature sensor and 2 switches. The heater is connected to one switch, the cooler/fan is connected to another.
I want to create a single virtual thermostat that would receive temperature measurement from the sensor and decide whether to turn on/off the first switch and the second.

The decision will be made based on the current temperature measurements and configured cooling/heating setpoints and it will be reflected to the user with thermostatOperatingState capability.

The user then may create an automation, saying that if the state is ‘cooling’ then cooling switch should be on, heating switch should be off. Then to create another automation saying that if the state is ‘heating’ the cooling switch should be off, the heating switch should be on. Then to proceed to the third automation, if the state is idle, turn both switches off.
As alternative, it is possible to add 2 switch capabilities, one for heating, another for cooling and then to create an automation that controls the physical switches, based on the state of thermostat’s virtual switches.
So the thermostat does not need to control other devices (switches) directly, this can be achieved with automation, that would connect switch capabilities of virtual thermostat and physical switches.

Does it make any sense?

However, the thermostat needs to be able to receive the measurement from the external sensors.
I was looking at standard temperatureMeasurement capability. It can be used as a source/trigger for automation. However, it only can be a trigger for either exact value, ‘below’ some value or ‘above’.
It also can not be used in automation action at all.
I’m looking at a way to just copy the value of temperatureMeasurement capability (or any other custom capability) of one device to the exactly same capability on another device with local automation, without going to cloud.

Not directly, but rather with automation.
I also don’t need to access the sensors, just to receive their state/measurements somehow.

Thank you

Why not? If possible to control multiple devices that would eliminate automations as all intelligence will be happening within thermostat driver. I think that is possible as @Mariano_Colmenarejo created similar intelligence for his bulb driver

1 Like

How can you access the heater and cooler/fan measures/config? I mean, are they Zigbee, Z-Wave, Wi-Fi or they’re just electronic (not Smart) devices that have physical controls?
If you could share their brand and model, it would be very helpful.

This is because we need to read their measures (temperature) and config (cooling, heating, idle mode)

As I understand, @Mariano_Colmenarejo created automatic actions based on the settings defined in the driver, but those actions are applied to the same device that is controlled by it and doesn’t involve other devices. Is that correct, Mariano?

Yes, That is correct

1 Like

@nayelyz we were talking about intelligence in Virtual Thermostat, and I think that @ygerlovin has solved that. We are looking how to bring data from external temperature sensor, into virtual thermostat device’s current temperature field.

Ok, I took another look at your description and I believe I understand more, let me know if this is correct:

You have a Smart Temperature sensor which you want to integrate to ST with the capabilities:

  • TemperatureMeasurement
  • thermostatOperatingState (for the heating,cooling, idle states)
  • thermostatHeatingSetpoint
  • thermostatCoolingSetpoint

You would receive the value of the current temperature from the sensor and based on this you would control the other capabilities value within the driver.
This is possible because in your driver:

  1. You will receive the event of a temperature change (this depends on the communication protocol used by the Temperature sensor - Zigbee, Z-Wave, etc.)
  2. Then, you can compare this new value to the heating/cooling setpoints (they could be also saved in a device preference instead of a capability)
  3. And make a condition to change the thermostatOperatingState capability to the corresponding state

You would also need to integrate switch 1 (connected to the heater) and switch 2 (connected to the cooler/fan).
After that, you can create simple rules (in Automations) where the thermostatOperatingState is used as a condition, to change the switch 1 or switch 2 states accordingly.

It would be helpful if you could share:

  • A diagram of how you expect the communication to be in the integration.
  • Define which devices are already integrated to ST.
  • Brands and models of the Temperature Sensor and the switches

It would be Virtual Thermostat

This is pretty much everything is needed as everything else can be done through Automations.

I have multiple Zigbee and Z-wave Temperature sensors that can be utilized for this.

For example i would use this one due it’s size and battery that ladt really long time
Aqara Temperature/Humidity sensor
Also had Atmospheric pressure capability.

It is using custom DTH, but there is Edge Driver already available, but without Atmospheric pressure

Hi @nayelyz

The virtual thermostat will have 3 kinds (groups) of capabilities

  1. That receive the value from the external source. Either through automation, rules or anything else
  2. That are set by a user, either from the APP or API (or anything else)
  3. Set (calculated) by the thermostat

The actual switches and sensors are different devices, zigbee, wifi or z-wave. It doesn’t really matter as long as they are connected to the same account.

I will simplify things and omit fans control here, but the idea is pretty much the same as with heating/cooling.

The user will be responsible to setup the automation that triggers the switches, based on the operating state.
The user also will set the values for heating/cooling setpoints and the thermostat mode on the virtual thermostat.

Once thermostat receives the temperature measurement update from the external source it compares the value with heating and cooling setpoints and then based on the selected mode decides what should be the operating state.

Once the operating state changes, it will trigger the automation on the switches.

Now, it is fairly simple to control the switches with automation. Automations allow to thermostat to set switch capability value on another device.
However, I don’t see a way to setup automation on temperature sensor so it would be triggered on any temperature change. I also do not see a way to copy sensor’s temperature value to thermostat’s temperarure capability.
Basically 2 things are missing in automations:

  • Trigger/condition on any change, in addition to ‘below’, ‘above’ and ‘equal’
  • Action that allows to set the value, based on another value

Does it make any sense?


What I would try is:

1- In the Real temperature sensor Driver add all the custom capabilities necessary for the thermostat

2- Create custom capabilities to activate and deactivate the device Commands, which are the actions to be executed. Example “Fan”, “heater”, “Cooler” …

3- In the Real device that has to execute the command: I would make an automation that is activated according to the “On” or “Off” status of the custom capability from step 2.

4- So until all functions are completed.

1 Like

@Mariano_Colmenarejo Thank you for your answer.

The idea here is to allows using the existing sensors and their drivers without modification.
That would make virtual thermostat to actually be virtual and provide a great flexibility for the user, while keeping things simple.

Naturally, we can create a thermostat driver for every combination of temperature and humidity sensors on the market, but it would miss the whole point of virtual thermostat



You just have to add the fingerprint to the driver of each sensor you want to use.

But you can also do this if you want to use a virtual thermostat:

1- Create the capability to adjust the control temperature in the detail view
2- Create a capability to receive the action of an automation, for example:

  • Capability “Temp Control” type “number” where you will receive the action of several automations that will collect the control range of the thermostat: 18º to 22º with 0.5º increments. (10 Automations)
  • You do automations where if the temperature sensor = Xº write value “X” in the setcommand of the custom capability.
  • Reading the value of that capability in the virtual thermostat driver you know the temperature of the sensor and you can execute the actions.

3 - Create the capabilities to execute the actions, for example “Fan” with “On and Off” values.

4 - In the real device that executes the action, you do an automation with the condition of the value of the virtual Thermostat capability “Fan” = “on or Off” and Action Fan “on or off”

Sure there are more solutions using preferences!

1 Like

Or "Mirror” action in Automations

ok, based on your current configuration. You would need an extra SmartApp to act as a bridge between the sensors (which are installed and use their own handlers) and the Edge driver of “Virtual Thermostat”. This way, you would:

  • Create subscriptions to the temperatureMeasurement capability of those devices
  • Send the new value to “Virtual Thermostat” from there.

There are other options to achieve the same functionality like: