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()
Please help me.