Tedee smart lock - anyone?

After looking up some details on the website (here f.e.), i think the tedee smartlook does not communicate via IP but bluetooth only. You need the bridge to make it cloudy.

Question is, what it takes to enable openHAB to communicate to the smartlock via bluetooth or - unprefered because of extra hardware - to communicate with the bridge. Then: stop the bridge being cloudy. That’ll mean, you can’t close your door in the US while visiting Africa via the tedee app. But you might use myopenhab …

I think this to be a nice device. The rechargable battery and the way the usb-cable is built to fall off, when the smartlock rotates (magnetically, not magically though) show that this was not a quick shot of a developer new to smart locks.

The only thing i miss is a way to keep my installed cylinder, which is part of a system. And the price is higher than danalock’s z-wave version.

That’s the point.
If the bridge (if local API on it is available) I could connect to the bridge with REST, curl or whatever and control it from OH.
But because it still WITH cloud, I have chosen the Danalock

You can connect to Danalock v3 dc to where the batteries are. It is working great.

2 Likes

But it does not look nice, does it? :wink:
So I think the tedee solution for recharging every now and then with a magnetic cable is a good approach.

I have tedee smart lock - anyone get connect with openhab?

i find plugin for homebridge

so at black week time, I ordered full package of tedee smart lock with a new lock and the bridge coming from danalock v3 bt & zwave.

the main reason why I switched was that, at least, my danalock has issues with they security key which needs to be manually refreshed every 1-2 days manually via the app. the community and official support of danalock manufacture is sooo bad. I wrote 3 mails in over 5 weeks and I got NO response. it feels like they are totally dead.

tedee has a cloud rest api which works great. as far as I know a local rest api will follow. currently I included the tedee smartlock with the bridge in openhab with external php scripts I’m calling. An openhab binding would be great to have :slight_smile:

the smart lock itself is really small (~4cm diameter) and compared to danalock and nuki, the motor is very silent.

Tedee looks good but also a bit like Nuki? Not sure what the difference is. Does the Tedee closes as fast as it shows in the promo video? I also came across LOQED, it’s a more integrated solution and completely keyless. Haven’t made up my mind yet but I like the fact is has an in and outdoor sensor.

Anyone experience with them?

@DubZ
Hi, i just changed to Tedee from Danalock , also v3 bt&z-wave, because of exactly the same reasons as you.
Right now i was looking for a possibility to integrate it into my OpenHab.
you wrote that you’re using a PHP script to integrate it with OpenHab, would you mind to share it?

thanks in advance

@Matt77 I can share it in some hours when I’m back at home. You also own the bridge?! Without, it won’t work.

@Jinte tedee is similar to nuki. What I can say is:
Currently, nuki community is bigger. Very big developer community. Tedee is new and community just starts.

Tedee looks a lot better (and is smaller), is faster, and more silent. But also more expensive. And yes, it closes as fast as in the demo videos.

I actually use the same lock.
Because I use it natively with z-wave. , there is no need for a bridge (FYI @DubZ).

I was talking about tedee… Regarding bridge.

Ah, sorry :wink:

Thanks a lot.
Yes I have the bridge as well.

So here is the php script:

<!DOCTYPE html>
<body>
	<?php
    
        
		$tokenExpireFile = file_get_contents("expires.txt");
		$tokenExpireObj = DateTime::createFromFormat('d.m.Y H:i:s', $tokenExpireFile);

		function httpCall($url, $data, $headers, $method) {
			$options = array(
				'http' => array(
                    'header'  => $headers,
					'method'  => $method,
					'content' => $data
				)
			);
			$context  = stream_context_create($options);
			$result = file_get_contents($url, false, $context);
			echo "sent";
        }

		function httpAuth($url, $data, $headers, $method, $tokenExpireObj) 
		{
			$currentTime = new DateTime();

			if($currentTime >= $tokenExpireObj) {
				$options = array(
					'http' => array(
						'header'  => $headers,
						'method'  => $method,
						'content' => $data
					)
				);
				$context  = stream_context_create($options);
				$result = file_get_contents($url, false, $context);
				$json = json_decode($result);

				$expiresIn = $json->expires_in;
				$accessToken = $json->access_token;
				$tokenExpiresDate = new DateTime();
				$tokenExpiresDate->add(new DateInterval("PT".$expiresIn."S"));
				$post = $tokenExpiresDate->format("d.m.Y H:i:s");

				$fp = fopen('expires.txt', 'w');
				fwrite($fp, $post);
				fclose($fp);
	
				$fp = fopen('token.txt', 'w');
				fwrite($fp, $accessToken);
				fclose($fp);
	
				echo "generated new token\r\n";
			} 
			
		}
		
		if ($_GET["code"] == 123456)
		{

			$url = 'https://tedee.b2clogin.com/tedee.onmicrosoft.com/B2C_1_SignIn_Ropc/oauth2/v2.0/token';
			$headers = "Content-Type: application/x-www-form-urlencoded";
			$data = http_build_query(array("grant_type" => "password",
							"client_id" => "your client id",
							"scope" => "openid your client id",
							"response_type" => "token",
							"username" => "your user / email",
							"password" => "your account password"
					));
			$method = "POST";
			httpAuth($url, $data, $headers, $method, $tokenExpireObj);

			$token = file_get_contents("token.txt");

			$url = 'https://api.tedee.com/api/v1.15/my/lock/open';
			$headers = ["Content-Type: application/json", 
			"Authorization: Bearer ".$token];
			$data = array("deviceId" => 4123, "openParameter" => 1);
			$JSON = json_encode($data);
			$method="POST";
			httpCall($url, $JSON, $headers, $method, $token);

			echo "<br>abgeschickt";
		} 
		else {
			echo "wrong code";
		}
			
	?>
</body>

currently I use tedee not integrated in openhab but with this php script. I use HTTP Shortcuts app on android to make http request to this script like https://servername.com/dooropener.php?code=123456
you have to make sure, that your webserver / reverse proxy is secured via tls (https) that nobody can sniff your code (because I can use this script through the internet without to be logged in to wifi).

additionally, you have to find out your device id: Tedee WebAPI Documentation
here you can read, how to generate a token code that you can execute the device request: How to authenticate — Tedee API documentation documentation (readthedocs-hosted.com)

keep in mind that you need to insert your individual stuff at two places: first username/password and second the device id.

and the folder where you place and save my php script, there you have to manually create a token.txt and expires.txt file (keep it empty… it will be temporary filled from my script).

@DubZ
thanks a lot for yous script, i’m sure it will help me with my integration.

By the way:
The batteries on my dana lock v3 bt&z-wave needed to be replaced after 4 months

1 Like

Hi there,

I posted a tutorial with openhab rules here: https://community.openhab.org/t/tedee-smartlock-integration-via-rules-and-http-calls/125892

The rules take care of the token retrieval and the respective items can be used directly where needed

4 Likes

Hello
Im new but read the treath all related to the cloud API.
This company has a BLE API, for local control
https://tedee-tedee-lock-ble-api-doc.readthedocs-hosted.com/en/latest/index.html
Can we use OpenHAB (https://www.openhab.org/addons/bindings/bluetooth/) to control the Tedee lock?
This will be full autonomous control without cloud.
Could be possible?
Thanks!

Updated cloud version for 2023 is here:

+++