Giter VIP home page Giter VIP logo

samsung-appliance-token's Introduction

samsung-appliance-token

Fetch authorization token from Samsung applicances with an API on port 8888, for local consumption with Homeassistant.

Step 0: Use SmartThings app to connect applicance to Wifi.
Optional Step 0a: Block from internet. (VLAN, Pause indefinitley, whatever)

Step 1: Download cert.pem and listener.py to a local directory.
Step 2: Open 2 bash sessions.
Step 3: Run listener.py python listener.py , you should see a message Listening on localhost:8889
Step 4: Run this command in the other window, replacing the Host IP (YY) with that of the device you are currently on, and the target IP (ZZ) with that of the appliance.
curl -k -H "Content-Type: application/json" -H "DeviceToken: xxxxxxxxxxx" --cert cert.pem --insecure -X POST https://192.168.ZZ.ZZ:8888/devicetoken/request -H "Host: 192.168.YY.YY:8889" -v

This will return a Authorization Bearer. Replace WW in Step 5.

Step 5: To confirm it worked, you should be able to now run the following and get json back; curl -m 8 -k -H "Content-Type: application/json" -H "Authorization: Bearer WWWWW" --cert cert.pem --insecure -X GET https://192.168.ZZ.ZZ:8888/devices/0/operation

Step 6 (prior to HA 2023.6.2): Add the following to sensors.yaml

# Samsung Dryer as an example, should be the same for Airconditioner, Washer, and Dishwasher
- platform: command_line
  command: curl -m 8 -k -H 'Content-Type:application/json' -H 'Authorization:Bearer WWWWW' --cert /ssl/cert.pem --insecure --silent -X GET https://192.168.ZZ.ZZ:8888/devices/0/operation | sed -r -e 's/:\{/:\{\},/' -e 's/\}\}/\}/'
  scan_interval: 30
  name: "Dryer"
  value_template: "{{ value_json['progress'] }}"
  json_attributes:
    - state
    - progress
    - progressPercentage
    - remainingTime

Step 6 (2023.6.2 onward): Add the following to command_line.yaml

# Samsung Dryer as an example, should be the same for Airconditioner, Washer, and Dishwasher
- sensor:
    command: curl -m 8 -k -H 'Content-Type:application/json' -H 'Authorization:Bearer WWWWW' --cert /ssl/cert.pem --insecure --silent -X GET https://192.168.ZZ.ZZ:8888/devices/0/operation | sed -r -e 's/:\{/:\{\},/' -e 's/\}\}/\}/'
    scan_interval: 30
    name: "Dryer"
    value_template: "{{ value_json['progress'] }}"
    json_attributes:
      - state
      - progress
      - progressPercentage
      - remainingTime

samsung-appliance-token's People

Contributors

braystorm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.