Using Telldus with Tesla

Moderator: Telldus

Post Reply
PetriK
Posts: 33
Joined: Fri Mar 17, 2023 9:45 am

Using Telldus with Tesla

Post by PetriK »

Due to the fact that we have only one 25 fuse at our summerhouse I need to be able to connect devices off and on depending on consumption. All the other devices have an on/off switch but unfortunately connecting power off from Wall charger for Tesla puts the charging into error state. Therefore an on/off switch does not work to control Tesla charging. Its said that on/off Works with UMC but I rather keep on using the Wall charger.

Luckily figured out an alternative method. As I am using teslafi.com that has an api to control various Tesla functions. For example the following command stops and starts charging:
www.teslafi.com/feed.php?token=TOKEN&co ... harge_stop
www.teslafi.com/feed.php?token=TOKEN&co ... arge_start

Anyhow unfortunately live.telldus.com does not Support https so I also needed a command converter to receive http:// commands from telldus and push https:// commands to tesla.fi. Below is the script for anyone utilize.

Additionally if you need this you can use it from your telldus with the following syntax to convert the commands to https:
www.macmadigan.com/teslafi.php?token=TO ... harge_stop


<?php
//$_SERVER;
//print_r($GLOBALS);
$url = 'https://www.teslafi.com/feed.php?';
echo " $url \n";
$param = $_SERVER['QUERY_STRING'];
echo "param: $param\n";
$url=$url.$param;
echo " $url \n";

// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt(CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);
?>
Post Reply