Copy an attribute from a real device to a virtual device


#1

1) Give a description of the problem
I have several devices that report temperature. I’d like to poll that information from Google Assistant so that my Google Home speaks it back. I know I could do this by changing the device handler of the devices to a thermostat, but then I lose the functionality of those devices (motion sensors and door contacts). I thought I could just create a virtual thermostat then write a piston to capture the temperature attribute from the real device to a local state and then restore the local state to the virtual device, but its not working.

2) What is the expected behavior?
Real device attributes copied to virtual device attributes

3) What is happening/not happening?
Its not copying the attributes

**4) Post a Green Snapshot of the piston![image|45x37]


#2

Can GA poll info from a virtual thermostat?


#3

Yes. Its a little back door trick. If you set a device that has a temperature capability to the Thermostat device handler, Google Home will think its a thermostat and you can ask, “What’s the temperature in Device Name” and it’ll tell you the temperature. But when you do this, you lose the ability to use it as the intended device type.


#4

How about setting up a virtual one like in this thread. Feed it values from other devices (averaged or single), then you can poll it with GA.


#5

That should do exactly what I want… but how do I do the expressions setTemperature()?

I can’t find how to do that in WebCoRE


#6

Once you get the virtual thermostat set up and selected as the device, the custom command setTemperature() will be available.

image


#7

I had originally set it up as a “Thermostat Capablity” device type… that was wrong. I changed it to Simulated Thermostat, but it looks like WebCoRE didn’t see the change so it was only providing me with the Thermostat Capability options. I ended up creating a new device as a Simulated Thermostat and now those options are showing up, I should be good to go from here. Thanks!