Samsung Smart TV APIs

Here for general support for E series TVs, request and problem solve area.
Post Reply

beresnevdr
Posts: 1
Joined: Fri Nov 09, 2018 5:45 am

Samsung Smart TV APIs

Post by beresnevdr »

Hello.

My model is Samsung UE40ES5507.
This script for API https://github.com/casperboone/homey-sa ... samsung.md
Port API 7676.

Request command GetAvailableActions.
Response (401, 'Unauthorised')

This script python:

Code: Select all

import httplib, urllib2

class TVControl:
    def __init__(self,hostname):
        self.Hostname=hostname

    def SendSOAP(self,method,body):
        print '*',method

        headers = {
            "Content-type": 'text/xml;charset="utf-8"',
            "SOAPACTION": '"urn:samsung.com:service:MainTVAgent2:1#%s"' % method
        }

        conn = httplib.HTTPConnection(self.Hostname)
        conn.request("POST", "/smp_4_", body, headers)

        response = conn.getresponse()
        print(response.status, response.reason)

        data = response.read()

        print data
        print ''

        return data

    def GetAvailableActions(self):
        body='<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'+\
                '<s:Body>'+\
                    '<u:GetAvailableActions xmlns:u="urn:samsung.com:service:MainTVAgent2:1"></u:GetAvailableActions>'+\
                '</s:Body>'+\
            '</s:Envelope>'
        self.SendSOAP('GetAvailableActions',body)

tvcontrol=TVControl("10.147.241.1:7676")

tvcontrol.GetAvailableActions()
I need to get information about the current channel, volume, etc.
Please help me.

Post Reply

Return to “[E] Support”