Keep the light display OFF when AC turns ON?

Hi,

I set an automation for my Samsung AC (turn ON when temperature is 24°+ during night).
My problem is : each time the AC turns ON, the light display turns ON too…
Even if I turn off the light display manually in the menu, it keeps getting back ON when the AC reactivates (with automation or if i turn ON manually).

Does anyone know how to keep it OFF, please ? It’s very annoying !
Especially at night because it wakes me up.

Thank you for your help :slight_smile:

Edit : I corrected my post because i made a mistake in OP => the light doesn’t stays OFF in manual mode.
Turning the light OFF only applies while the AC is turned ON. But once the AC goes OFF, the light will be back ON on next start (via automation or manual mode).

Hi, @Shugojin. Welcome to the SmartThings Community!

I saw some users were sending this API command to control the light, but I don’t know if it still works or not:

If it does, you could create a Rule in the Rules API to turn the AC on based on your condition and turn the display off as well.

First, to verify the command still works, you need to copy that command and make a REST request to your device using the SmartThings API. For example, this would be the command using cURL:

Here you can get your Personal Access Token > Samsung account

Please, let me know if you have any questions.

2 Likes

Hi @Shugojin, currently I’m still using this but if you change something on your AC (ex. change temperature) the light will turn on again.

Now I got some devices with new version and it has been fixed (the light still on the latest status) but only on those new devices.

2 Likes

Hi,

Thank you very much for all these detailed informations.
Unfortunately, i have some notions of coding when i learned a little 20 years ago but that’s it ^^’

Could you tell me where do i have to put the cURL exemple you gave to me, please ?
Is there an app to manage all of this ?
Do i have to let a computer running 24/7 to execute this, then ? Or once the cURL is done, it’s forever ?

Thanks again for your help :slight_smile:

This is a one-time-only execution, because the URL I provided is a device command, not an automation, so, once you send it, it will only work one-time.

  1. For the request, you can use a program that helps you send them. You can install Postman
  2. First, you need to create a Personal Access Token, preferably selecting all the scopes (Samsung account)
  3. Start a new request by typing GET, in the URL use https://api.smartthings.com/v1/devices to list all the devices in your account
  4. Take the Personal Access Token and set it up in Postman. In the Tab “Authorization” select “Bearer Token” as Auth Type and paste the token in the box instead of xxxx-xxxxx-xxxx:
  5. Send the request.
    a. Find your device and copy the value shown in the property “deviceId” - save it for later.
  6. Change the URL to send a command to the device:
https://api.smartthings.com/v1/devices/deviceId/commands

----> Replace “deviceId” with the value you copy in the previous step
8. In the tab “Body”, paste the JSON shared by @JRFabbi and hit “send”


See if the display’s light changes status, according to the post “off is display on, on is display off”, so, that command should turn it off.

Just a reminder, this first actions is to see if the command works on your device, then we’ll see about creating a Rule.

2 Likes

Thank you so much <3
I try this tomorrow morning !

1 Like

Hi,

So i just tried your guide and it worked !
But, it only works IF the AC is already ON. It’s not permanently but maybe is this normal ?
If there is a command to disable light forever, i could take it instead of creating a complex automation just for the light :wink:

Not that I’m aware of, if you turn the display off but whenever the device receives a new command it turns on, then, it is an action from the device itself and @JRFabbi mentioned seeing that same behavior.

Hi,

I just came back from holidays and since it’s pretty hot here, i’d like to configure my routine with the Postman solution you gave me.

Here is my actual routine in ST :
If temperature > 24° in my bedroom between 0 a.m and 6 a.m => launch AC for 25min in windfree mode at 20°.

Could you help me to reproduce this through Postman, adding the light off when AC turns ON, please ? :slight_smile:

I’m really sorry, i don’t know how to do this by myself.

Again, thank you really much for all the time you already took to help me.

Have a nice day !

Hi!

I made this sample, but I’m doubtful because I don’t know the exact capabilities supported by your device that allows you to select “windfree” and the 20º setpoint.

Can you see if this works?

{
    "name": "If temp above 24 turn AC on and display off",
    "actions": [
        {
            "if": {
                "and": [
                    {
                        "changes": {
                            "greaterThanOrEquals": {
                                "left": {
                                    "device": {
                                        "devices": [
                                            "temperatureSensor or AC deviceID"
                                        ],
                                        "component": "main",
                                        "capability": "temperatureMeasurement",
                                        "attribute": "temperature"
                                    }
                                },
                                "right": {
                                    "integer": 24
                                }
                            }
                        }
                    },
                    {
                        "between": {
                            "value": {
                                "time": {
                                    "reference": "Now"
                                }
                            },
                            "start": {
                                "time": {
                                    "reference": "Midnight"
                                }
                            },
                            "end": {
                                "time": {
                                    "reference": "Midnight",
                                    "offset": {
                                        "value": {
                                            "integer": 6
                                        },
                                        "unit": "Hour"
                                    }
                                }
                            }
                        }
                    }
                ],
                "then": [
                    {
                        "command": {
                            "devices": [
                               "AC-device-ID"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "on"
                                },
                                {
                                    "component": "main",
                                    "capability": "thermostatCoolingSetpoint",
                                    "command": "setCoolingSetpoint",
                                    "arguments": [
                                        {
                                            "integer":20
                                        }
                                    ]
                                },
                                {
                                    "component": "main",
                                    "capability": "airConditionerMode",
                                    "command": "setAirConditionerMode",
                                    "arguments": [
                                        {
                                            "string":"wind"
                                        }
                                    ]
                                },
                                {
                                    "component": "main",
                                    "capability": "execute",
                                    "command": "execute",
                                    "arguments": [
                                        {"string": "mode/vs/0"},
                                        {"map": {"x.com.samsung.da.options": {"string":"Light_On"}}}
                                    ]
                                }
                            ]
                        }
                    },
                    {
                        "sleep":{
                            "duration":{
                                "value":{
                                "integer":25
                                },
                                "unit":"Second"
                            }
                        }
                    },
                    {
                        "command": {
                            "devices": [
                                "AC-device-ID"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "off"
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

You need to replace the device IDs, I don’t know if the same AC measures the temperature, if not you would need to replace it by the temperature sensor’s device ID.

To save this Rule, you need to call this URL:
https://api.smartthings.com/rules?locationId=locationId

The locationId is included in the device’s details or you can do a GET request to https://api.smartthings.com/v1/locations

Please let me know if you have any questions and we can go step by step.

2 Likes

Hi,

again thank you so much… i hope you have a paypal so i can tip you after all the time you took for me ^^’

I tried the POST command but i get this :
{
“requestId”: “761086164459075659”,
“error”: {
“code”: “ForbiddenError”,
“message”: “create-behavior-fail-invalid-scopes”,
“details”:
}
}

In “POST” i set this : https://api.smartthings.com/rules?locationId=xxx
But I may have an hesitation about the body.
In this section :
“greaterThanOrEquals”: {
“left”: {
“device”: {
“devices”: [
“temperatureSensor or AC deviceID” => i set this “xxxxxxxx” (deviceID). Is this ok or do i have to replace something in “temperatureSensor” too ?
For the record, i’m pretty sure the AC can measure temperature because if i open ST, AC tells me the temperature even when it’s OFF.

But when i do the GET command you first gave me, there is no temperatureSensor.
But again, there is a line saying about temperaturemeasurement so i don’t understand.

Here’s the GET command if it can help :
“deviceId”: “xxxxxx”,
“name”: “Samsung-Room-Air-Conditioner”,
“label”: “Clim Chambre Parents”,
“manufacturerName”: “Samsung Electronics”,
“presentationId”: “DA-AC-RAC-000003”,
“deviceManufacturerCode”: “Samsung Electronics”,
“locationId”: “xxxxxx”,
“ownerId”: “xxxxxxx”,
“roomId”: “xxxxxxx”,
“deviceTypeName”: “Samsung OCF Air Conditioner”,
“components”: [
{
“id”: “main”,
“label”: “main”,
“capabilities”: [
{
“id”: “ocf”,
“version”: 1
},
{
“id”: “switch”,
“version”: 1
},
{
“id”: “airConditionerMode”,
“version”: 1
},
{
“id”: “airConditionerFanMode”,
“version”: 1
},
{
“id”: “fanOscillationMode”,
“version”: 1
},
{
“id”: “temperatureMeasurement”,
** “version”: 1**
},
{
“id”: “thermostatCoolingSetpoint”,
“version”: 1
},
{
“id”: “relativeHumidityMeasurement”,
“version”: 1
},
{
“id”: “airQualitySensor”,
“version”: 1
},
{
“id”: “odorSensor”,
“version”: 1
},
{
“id”: “dustSensor”,
“version”: 1
},
{
“id”: “veryFineDustSensor”,
“version”: 1
},
{
“id”: “audioVolume”,
“version”: 1
},
{
“id”: “remoteControlStatus”,
“version”: 1
},
{
“id”: “powerConsumptionReport”,
“version”: 1
},
{
“id”: “demandResponseLoadControl”,
“version”: 1
},
{
“id”: “refresh”,
“version”: 1
},
{
“id”: “execute”,
“version”: 1
},
{
“id”: “custom.spiMode”,
“version”: 1
},
{
“id”: “custom.thermostatSetpointControl”,
“version”: 1
},
{
“id”: “custom.airConditionerOptionalMode”,
“version”: 1
},
{
“id”: “custom.airConditionerTropicalNightMode”,
“version”: 1
},
{
“id”: “custom.autoCleaningMode”,
“version”: 1
},
{
“id”: “custom.deviceReportStateConfiguration”,
“version”: 1
},
{
“id”: “custom.energyType”,
“version”: 1
},
{
“id”: “custom.dustFilter”,
“version”: 1
},
{
“id”: “custom.veryFineDustFilter”,
“version”: 1
},
{
“id”: “custom.deodorFilter”,
“version”: 1
},
{
“id”: “custom.electricHepaFilter”,
“version”: 1
},
{
“id”: “custom.doNotDisturbMode”,
“version”: 1
},
{
“id”: “custom.periodicSensing”,
“version”: 1
},
{
“id”: “custom.airConditionerOdorController”,
“version”: 1
},
{
“id”: “custom.ocfResourceVersion”,
“version”: 1
},
{
“id”: “custom.disabledCapabilities”,
“version”: 1
},
{
“id”: “samsungce.deviceIdentification”,
“version”: 1
},
{
“id”: “samsungce.dustFilterAlarm”,
“version”: 1
},
{
“id”: “samsungce.driverVersion”,
“version”: 1
},
{
“id”: “samsungce.softwareUpdate”,
“version”: 1
},
{
“id”: “samsungce.selfCheck”,
“version”: 1
},
{
“id”: “samsungce.individualControlLock”,
“version”: 1
}
],
“categories”: [
{
“name”: “AirConditioner”,
“categoryType”: “manufacturer”
}
]
}
],
“createTime”: “2024-06-07T19:30:49.435Z”,
“profile”: {
“id”: “xxxxxx”
},
“ocf”: {
“ocfDeviceType”: “oic.d.airconditioner”,
“name”: “Samsung-Room-Air-Conditioner”,
“specVersion”: “core.1.1.0”,
“verticalDomainSpecVersion”: “1.2.1”,
“manufacturerName”: “Samsung Electronics”,
“modelNumber”: “TP2X_RAC_20K|10217841|600105140014110142000035242432423”,
“platformVersion”: “DAWIT 2.0”,
“platformOS”: “TizenRT 2.0 + IPv6”,
“hwVersion”: “MediaTek”,
“firmwareVersion”: “TP2X_RAC_20K_11230531”,
“vendorId”: “DA-AC-RAC-000003”,
“vendorResourceClientServerVersion”: “MediaTek Release 2.220916.2”,
“lastSignupTime”: “2024-06-07T19:30:45.754977Z”,
“transferCandidate”: false,
“additionalAuthCodeRequired”: false
},
“type”: “OCF”,
“restrictionTier”: 0,
“allowed”: ,
“executionContext”: “CLOUD”

No worries, it’s part of my job to guide users with the SmartThings Development tools.

This is perfect, thank you.

Yes, you need to replace the text I typed with the device ID, there should be only that value.
I updated the Rule I created. I was doubtful because I didn’t know exactly which capabilities your device had because some are similar, but it depends on the manufacturer which one they use and I had a time reference incorrect (used “second” instead of “minute” for my tests).

{
    "name": "If temp above 24 turn AC on and display off",
    "actions": [
        {
            "if": {
                "and": [
                    {
                        "changes": {
                            "greaterThanOrEquals": {
                                "left": {
                                    "device": {
                                        "devices": [
                                            "AC deviceID"
                                        ],
                                        "component": "main",
                                        "capability": "temperatureMeasurement",
                                        "attribute": "temperature"
                                    }
                                },
                                "right": {
                                    "integer": 24
                                }
                            }
                        }
                    },
                    {
                        "between": {
                            "value": {
                                "time": {
                                    "reference": "Now"
                                }
                            },
                            "start": {
                                "time": {
                                    "reference": "Midnight"
                                }
                            },
                            "end": {
                                "time": {
                                    "reference": "Midnight",
                                    "offset": {
                                        "value": {
                                            "integer": 6
                                        },
                                        "unit": "Hour"
                                    }
                                }
                            }
                        }
                    }
                ],
                "then": [
                    {
                        "command": {
                            "devices": [
                               "AC-device-ID"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "on"
                                },
                                {
                                    "component": "main",
                                    "capability": "thermostatCoolingSetpoint",
                                    "command": "setCoolingSetpoint",
                                    "arguments": [
                                        {
                                            "integer":20
                                        }
                                    ]
                                },
                                {
                                    "component": "main",
                                    "capability": "airConditionerFanMode",
                                    "command": "setFanMode",
                                    "arguments": [
                                        {
                                            "string":"windfree"
                                        }
                                    ]
                                },
                                {
                                    "component": "main",
                                    "capability": "execute",
                                    "command": "execute",
                                    "arguments": [
                                        {"string": "mode/vs/0"},
                                        {"map": {"x.com.samsung.da.options": {"string":"Light_On"}}}
                                    ]
                                }
                            ]
                        }
                    },
                    {
                        "sleep":{
                            "duration":{
                                "value":{
                                "integer":25
                                },
                                "unit":"Minute"
                            }
                        }
                    },
                    {
                        "command": {
                            "devices": [
                                "AC-device-ID"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "off"
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}
1 Like

Hi,

Thank you again for your help.
Unfortunately, i still get this error :
{
“requestId”: “4026807694582952750”,
“error”: {
“code”: “ForbiddenError”,
“message”: “create-behavior-fail-invalid-scopes”,
“details”:
}
}

To be sure i’m not doing anything wrong :

  1. I have set my Samsung token in “bearer token” from tab “Authorization” (and i’m sure the token is OK because it works with the GET command).

  2. I set this in “POST” : https://api.smartthings.com/rules?locationId=xxx (i’m sure about my locationid too since i copy/paste and triple checked it from the result of GET command).

  3. In body, i replace the 3 “AC-device-ID” with the good one.

Hope i didn’t make a mistake ^^’

Hi @nayelyz

I wondered if you could point me in the right direction. I’m a developer but struggling with sending correct payload for creating Rule, that would turn off the AC light at 11 PM everyday. (It seems that AC is turning it back on during the day).

I successfully enable/disable light by sending requests to devices/{id}/commands endpoint.

This works as expected:

curl --request POST \
  --url https://api.smartthings.com/v1/devices/**device id**/commands \
  --header 'Authorization: Bearer **redacted**' \
  --header 'Content-Type: application/json' \
  --data '{
	"commands": [
		{
			"component": "main",
			"capability": "execute",
			"command": "execute",
			"arguments": [
				"mode/vs/0",
				{
					"x.com.samsung.da.options": [
						"Light_Off"
					]
				}
			]
		}
	]
}
'

Well, expect Light_Off turns it on, and Light_On turns it off but no biggie :blush:

So I’m sending following:

curl --request POST \
  --url 'https://api.smartthings.com/v1/rules?locationId=**redacted**' \
  --header 'Authorization: Bearer **redacted**' \
  --header 'Content-Type: application/json' \
  --data '{
	"name": "Turn AC light off in the evening",
	"actions": [
		{
			"every": {
				"specific": {
					"reference": "Noon",
					"offset": {
						"value": {
							"integer": 660
						},
						"unit": "Minute"
					}
				},
				"actions": [
					{
						"command": {
							"devices": [
								"**redacted**"
							],
							"commands": [
								{
									"component": "main",
									"capability": "execute",
									"command": "execute",
									"arguments": [
										"mode/vs/0",
										{
											"x.com.samsung.da.options": [
												"Light_Off"
											]
										}
									]
								}
							]
						}
					}
				]
			}
		}
	]
}'

But it seems that my arguments is invalid for that endpoint, as I’m getting back:

{
	"requestId": "1263659791704468869",
	"error": {
		"code": "ConstraintViolationError",
		"message": "The request is malformed.",
		"details": [
			{
				"code": "BodyMalformedError",
				"target": "Unknown target",
				"message": "Malformed body on line 27:11",
				"details": []
			}
		]
	}
}

Could you please advise on what I’m supposed to send to get it to work? Thank you :wink:

Hi, @patrickJ
Welcome to the SmartThings Community!

Sure, I shared a sample above on how that command should be sent:

In the Rules API, command arguments are not set directly, you need to specify their data type first like this other sample:

{
      "component": "main",
      "capability": "airConditionerFanMode",
      "command": "setFanMode",
      "arguments": [
          {
              "string":"windfree"
          }
      ]
  }

Thank you! I managed to create it with following (below). It is getting created successfully but it doesn’t run at all. Looking at the “dateCreated” in response, it seems that SmartThings server is using UTC timezone. So I understand that “357 minutes after Noon” is 17:57 - is that how that works? I created rule at 2024-07-25T17:56:16Z. Any tips?

curl --request POST \
  --url 'https://api.smartthings.com/v1/rules?locationId=**redacted**' \
  --header 'Authorization: Bearer **redacted**' \
  --header 'Content-Type: application/json' \
  --data '{
	"name": "Turn AC light off in the evening",
	"actions": [
		{
			"every": {
				"specific": {
					"reference": "Noon",
					"offset": {
						"value": {
							"integer": 357
						},
						"unit": "Minute"
					}
				},
				"actions": [
					{
						"command": {
							"devices": [
								"**redacted**"
							],
							"commands": [
								{
									"component": "main",
									"capability": "execute",
									"command": "execute",
									"arguments": [
										{
											"string": "mode/vs/0"
										},
										{
											"map": {
												"x.com.samsung.da.options": {
													"string": "Light_On"
												}
											}
										}
									]
								}
							]
						}
					}
				]
			}
		}
	]
}'

About this error, @Shugojin, I asked the team and they mentioned you should make sure you selected all the options in “Rules” because each belongs to a different scope and this endpoint needs w:rules.
These are the options I mean:
image

1 Like

Yes, the engineering team mentioned that you can specify a timezone for this Rule which will be preferred.
Otherwise, it will take the timezone in your location, if that’s not set either, it will use UTC.

So, they suggest you use the same timezone as your location, to check that you need to do a GET request to https://api.smartthings.com/v1/locations/locationId.

The property timezone is another key inside “specific”, for example:

"specific": {
    "reference": "Noon",
    "timeZoneId": "America/New_York",
    "offset": {
        "value": {
            "integer": -180
        },
        "unit": "Minute"
    }
}

The API doc mentions timeZoneId is a “Java time zone ID reference”:

Hi,

I created a new token with all options checked and it’s working now ! Thank you ^^

Just a question : if i change a setting in my rule and i post then, does it overwrite ?
I don’t want to end with 50 rules running at the same time so i prefer to be sure about this :wink:

I suggest you modify the Rule already created. If you use POST each time, you’ll create a new Rule because the Name isn’t checked either (I tested that).
So, if you don’t have the Rule’s ID, you can query all the existing Rules by changing POST with GET and excluding the Body:
image

Then, copy the ID of the corresponding Rule, change GET by PUT and add the ID in the URL as shown below. The body is the same as in POST with the changes you want to apply.

1 Like