Rest Switch & Command Line for Teslafi

Hi all,

So I’ve been fiddling around with this and just can’t get it to work. Teslafi is a website that monitors my car and retrieves all sorts of data that I can pull into HA which I have working fine.

It also allows me to send a few commands to the car. One of these is to turn on the HVAC/air conditioning. I’m using the correct urls as if I pop them in to a web browser they fire just fine, I just can’t get them to work in a switch in HA.

I used the sample code from HA guides and adapted it to my code…

# TeslaFi Switches
switch:
  - platform: command_line
    switches:
      teslafi_climate:
        command_on: "/usr/bin/curl -X GET https://www.teslafi.com/feed.php?token=xxxxx&command=auto_conditioning_start"
        command_off: "/usr/bin/curl -X GET https://www.teslafi.com/feed.php?token=xxxxx&command=auto_conditioning_stop"
        friendly_name: HVAC

What kind of installation type of HA?
Does the command work if you start it in a terminal?
If you run Home Assistant OS, try it inside the HA container.

Didn’t realise I could run the command via SSH from HA :slight_smile:

I’ve done that and I’m getting a 537 response with a huge json return. I should be getting this …

{"response":{"reason":"","result":true}}

Fixed it :slight_smile:

Simply enclosing the URL in “” fixed the problem. I contacted the owner of Teslafi and he said the response I was getting is because the command wasn’t being received. It’s only because he said the command was getting cut off I thought maybe the & in the URL was causing an issue.