Mirror temperature sensor to virtual device

Is it possible to mirror temperature from a Qubino Flush 1 with temperature sensor probe to a virtual temperature sensor?
When the temperature is changing, the virtual sensor should be updated.

Yes, you can do it with a very simple rule.

1 Like

Please explain.
I can figure it out?
Do you mean with a standard automation?

No, I mean using the Rules API. It is quite simple. It is really just some cutting and pasting.

When I get a chance this afternoon I will start-up my laptop, copy the code for you, and paste it in this thread. You will only need to change 2 device ID numbers, save the file and upload using the API Browser+.

If you are not already the API Browser+ you should set it up now. It is a great tool and a partial replacement for the IDE. The following is the link for setting it up.

2 Likes

The following is the sample code. Copy the code and paste it into a text editor such as Notepad or even better Notepad++. Save the file with a name like Name.json

You can change the Name in the first line to what ever you want. You can change the refresh time in line 8. The 1st long string of numbers and letters is the Device ID for the target device which is your virtual temperature sensor. The 2nd long string of numbers and letters is the Device ID for the source device which is Qubino Flush 1. You can get the device ID numbers from the API Brower+ or my.smartthings.com

Save the file after editing and create your rule using the API Brower+. Go the Automations button, Rules button, Create Rules button, and follow the prompts.

{
  "name": "Freezer Temperature update every 5 minutes",
  "actions": [
        {
            "every": {
                "interval": {
                    "value": {
                        "integer": 5
                    },
                    "unit": "Minute"
                  },
			  "actions": [
						 {
						"command": {
						  "devices": [
							"f20f7564-9af4-4e68-991a-aa066c75bce1"
						  ],
						  "commands": [
							{
							  "component": "main",
							  "capability": "partyvoice23922.vtempset",
							  "command": "setvTemp",
							  "arguments": [
								{
								  "device": {
									"devices": [
									  "c344957b-2da8-452d-9e4c-f86569162240"
									],
									"component": "main",
									"capability": "temperatureMeasurement",
									"attribute": "temperature"
								  }
								}
							  ]
							}
						  ]
						}
					  }
					]
	         }
	     }
	]
}
2 Likes

Thanks for the code.
However, I get the following error when I try to import the file: “HTTP error422, the request is malformed”
The virtual temperature sensor is created from vDev Controller.

Here is my code:

{
“name”: “Utomhus temperatur uppdateras var 5 minut”,
“actions”: [
{
“every”: {
“interval”: {
“value”: {
“integer”: 5
},
“unit”: “Minute”
},
“actions”: [
{
“command”: {
“devices”: [
“757d033d-0168-4934-b6c8-d270893b01ad”
],
“commands”: [
{
“component”: “main”,
“capability”: “partyvoice23922.vtempset”,
“command”: “setvTemp”,
“arguments”: [
{
“device”: {
“devices”: [
“b64a38a7-907d-406a-90f8-c8cf7a0eae81”
],
“component”: “main”,
“capability”: “temperatureMeasurement”,
“attribute”: “temperature”
}
}
]
}
]
}
}
]
}
}
]
}

Please form the code. Highlight the code go to gear symbol above and pick </>.

One possible problem is you " marks. They get messed up posting and copying. Make sure all your " marks are all straight not curved.

Also you need to change your file name each time before you try to upload the code.

I only changed the 2 different ID:s and the name as you suggested. No other changes.

{
  "name": "UtomhusTemperatur",
  "actions": [
        {
            "every": {
                "interval": {
                    "value": {
                        "integer": 5
                    },
                    "unit": "Minute"
                  },
			  "actions": [
						 {
						"command": {
						  "devices": [
							"757d033d-0168-4934-b6c8-d270893b08ad"
						  ],
						  "commands": [
							{
							  "component": "main",
							  "capability": "partyvoice23922.vtempset",
							  "command": "setvTemp",
							  "arguments": [
								{
								  "device": {
									"devices": [
									  "b64a38a7-907d-406a-90f8-c8cf7a0eae86"
									],
									"component": "main",
									"capability": "temperatureMeasurement",
									"attribute": "temperature"
								  }
								}
							  ]
							}
						  ]
						}
					  }
					]
	         }
	     }
	]
}
1 Like

The malformed request error usually means the API thinks what it has received doesn’t match the content type. It should be expecting JSON and that seems to be valid JSON.

It’s a json and I have renamed the file. Still, I get the same error message.
image

Sorry my delay in responding.

I looked at you file and it looked ok to my untrained eye, so I downloaded your file changed the device IDs to devices I have. When I tried to create the rule I also got the malformed error.

So next I took an existing rule of mine that works and inserted new IDs. When I tried to create the modified rule I also got the malformed error.

So next I took and existing rule of mine that works and just changed the rule name and file name. When I tried to create the modified rule it worked. So now I have some more digging to do.

PS: I am not a coder. I am basically a copy and paster.

I think I found the problem. Virtual temperature sensors created by vDev Controller don’t work for some reason. Virtual temperature sensors created by taustin’s vEdge Creator do work.

So you should be able to get it working by using a virtual temperature sensors created by vEdge Creator.

PS: I created the successful file using a copy of what you posted.

Let us know how you make out.

Thanks a lot, .
I’ll let you know if it works!

It works now. Thanks alot!

1 Like

I am glad it worked for you and I learned something in the process. Once you get 1 rule working it is easy to duplicate and make more.

1 Like

This is pretty cool. Thank-you!

Hi. I am trying to create a Rule like you did. I used a code posted by @paros, but have the following error:
image
I am using taustin’s vEdge Creator to create virtual Temperature sensor. Any ideas what is the error here?

EDIT: Problem solved, I used wrong token without Rules write privilege. With correct token the rule works perfectly fine.

2 Likes