Did you check that your HASS installation is allowed to access the TV? Did you get an access request on the TV at the beginning?
Yes, got that request and accepted.
In HASS the only thing that works is the on/off status. Cant use any of the buttons and the source is empty.
/Ola
Could you try the following code? Don’t forget to change the IP to the Ip of your TV.
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("192.168.178.12:7676")
tvcontrol.GetAvailableActions()
This should show us what your TV can handle.
(’*’, ‘GetAvailableActions’)
(200, ‘OK’)
<s:Body>
<u:GetAvailableActionsResponse xmlns:u=“urn:samsung.com:service:MainTVAgent2:1”>OKDestroyGroupOwner,EnforceAKE,GetAPInformation,GetAllProgramInformationURL,GetAvailableActions,GetBannerInformation,GetChannelListURL,GetCurrentExternalSource,GetCurrentMainTVChannel,GetCurrentProgramInformationURL,GetDTVInformation,GetDetailProgramInformation,GetFilteredProgramURL,GetMBRDeviceList,GetMBRDongleStatus,GetRecordChannel,GetSourceList,SendMBRIRKey,SetAntennaMode,SetMainTVChannel,SetMainTVSource,StartCloneView,StartExtSourceView,StartSecondTVView,StopRecord,StopView</u:GetAvailableActionsResponse>
</s:Body>
</s:Envelope>
After creating the custom samsung file I get this error:
Error loading custom_components.media_player.samsungtv. Make sure all dependencies are installed
21:56 .homeassistant/custom_components/media_player/samsungtv.py (ERROR)
Which dependencies are meant? What should I do to make it work?
I am using HA 0.58 in a Python Virtual Env end the samsungtv.py file was created bu the user “homeassistant”
check if you have BeutifulSoap installed
/Ola
Thanks! It’s working now.
Unfortunately this custom component is not an improvement for me.
When turning off the TV (by the remote control, not HA) I want to get the lights brighter. This is actually working but it takes 10-15 minuten before HA notices the TV is off,
I’ve implemented dimming light, when I turn on my TV by using the NMAP tracker. When my TV Device change status to “Home” I turn a scene on and an other scene on when it change status to “not_home”. By default the NMAP scans for status every 3 min. but the interval can be changed in the config.
Hey, having a few issues trying to get this to work. I’ve installed all the required files, wakeonlan, and beautifulsoup4 (including the module bs4), but it’s just not working for me. Below is the error I’m getting.
Error loading custom_components.media_player.samsungtv. Make sure all dependencies are installed
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 142, in get_component
module = importlib.import_module(path)
File "/srv/homeassistant/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/homeassistant/.homeassistant/custom_components/media_player/samsungtv.py", line 9, in <module>
from bs4 import BeautifulSoup
ImportError: No module named 'bs4'
I have a H series TV, and seeing in the first post that this is supported got me excited.
I have this issue too. From log bellow I assume that something is not ok with my beautifulsoup4. How can I update it?
Thx.
2017-12-05 22:51:06 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.media_player.samsungtv. Make sure all dependencies are installed
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/loader.py”, line 142, in get_component
module = importlib.import_module(path)
File “/usr/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 978, in _gcd_import
File “”, line 961, in _find_and_load
File “”, line 950, in _find_and_load_unlocked
File “”, line 655, in _load_unlocked
File “”, line 678, in exec_module
File “”, line 205, in _call_with_frames_removed
File “/tmp/config/custom_components/media_player/samsungtv.py”, line 9, in
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named ‘bs4’
Hi,
do you use HASS:IO or Home Assistant in the virtual env?
Did you restart Home Assistant? It coould be that the requirement was not loaded fast enough:
.
.
from bs4 import BeautifulSoup
.
.
REQUIREMENTS = ['wakeonlan==0.2.2', 'beautifulsoup4==4.6.0']
.
.
You could try to exchange this two lines, so that the requirement is installed before it will be used (or imported).
Hi guys. I’m trying to add my QLed tv in Hass.io
Can anyone help me please ?
I’ve added the file in the custom _components/media_player and I’ve also changed the port to 8001 but nothing worked. I could not see any request from Hass.io on the TV set.
Any ideias ??
Been giving this a try as the standard samsungtv.py is a bit limited. Was looking for a way to retrieve a channel list and offer that …
The default works with my tv UE55MU6172 and gets status. However when trying the custom_component, I am not getting anywhere.
Output of http://192.168.1.211:8001/api/v2/
"device":{
"FrameTVSupport":"false",
"GamePadSupport":"true",
"ImeSyncedSupport":"true",
"OS":"Tizen",
"VoiceSupport":"true",
"countryCode":"RO",
"description":"Samsung DTV RCR",
"developerIP":"0.0.0.0",
"developerMode":"0",
"duid":"uuid:4b659b96-4d35-4c0b-a29f-1cec320b65fb",
"firmwareVersion":"Unknown",
"id":"uuid:4b659b96-4d35-4c0b-a29f-1cec320b65fb",
"ip":"192.168.1.211",
"model":"17_KANTM_UHD_BASIC",
"modelName":"UE55MU6172",
"name":"[TV] Samsung 6 Series (55)",
"networkType":"wireless",
"resolution":"3840x2160",
"smartHubAgreement":"true",
"ssid":"30:0c:23:a4:a7:6d",
"type":"Samsung SmartTV",
"udn":"uuid:4b659b96-4d35-4c0b-a29f-1cec320b65fb",
"wifiMac":"84:C0:EF:47:EE:85"
},
"id":"uuid:4b659b96-4d35-4c0b-a29f-1cec320b65fb",
"isSupport":"{\"DMP_DRM_PLAYREADY\":\"false\",\"DMP_DRM_WIDEVINE\":\"false\",\"DMP_available\":\"true\",\"EDEN_available\":\"true\",\"FrameTVSupport\":\"false\",\"ImeSyncedSupport\":\"true\",\"remote_available\":\"true\",\"remote_fourDirections\":\"true\",\"remote_touchPad\":\"true\",\"remote_voiceControl\":\"true\"}\n",
"name":"[TV] Samsung 6 Series (55)",
"remote":"1.0",
"type":"Samsung SmartTV",
"uri":"http://192.168.1.211:8001/api/v2/",
"version":"2.0.25"
}
Output of ./dlnap.py --ip 192.168.1.211 --log=debug --mute
INFO:DlnapDevice:location: http://192.168.1.211:9197/dmr
INFO:DlnapDevice:port: 9197
DEBUG:DlnapDevice:description xml: {u'root': [{u'device': [{u'manufacturerURL': [u'http://www.samsung.com/sec'], u'serviceList': [{u'service': [{u'controlURL': [u'/upnp/control/RenderingControl1'], u'serviceType': [u'urn:schemas-upnp-org:service:RenderingControl:1'], u'serviceId': [u'urn:upnp-org:serviceId:RenderingControl'], u'eventSubURL': [u'/upnp/event/RenderingControl1'], u'SCPDURL': [u'/RenderingControl_1.xml']}, {u'controlURL': [u'/upnp/control/ConnectionManager1'], u'serviceType': [u'urn:schemas-upnp-org:service:ConnectionManager:1'], u'serviceId': [u'urn:upnp-org:serviceId:ConnectionManager'], u'eventSubURL': [u'/upnp/event/ConnectionManager1'], u'SCPDURL': [u'/ConnectionManager_1.xml']}, {u'controlURL': [u'/upnp/control/AVTransport1'], u'serviceType': [u'urn:schemas-upnp-org:service:AVTransport:1'], u'serviceId': [u'urn:upnp-org:serviceId:AVTransport'], u'eventSubURL': [u'/upnp/event/AVTransport1'], u'SCPDURL': [u'/AVTransport_1.xml']}, {u'controlURL': [u'/upnp/control/StreamSplicing1'], u'serviceType': [u'urn:schemas-rvualliance-org:service:StreamSplicing:1'], u'serviceId': [u'urn:upnp-org:serviceId:StreamSplicing'], u'eventSubURL': [u'/upnp/event/StreamSplicing1'], u'SCPDURL': [u'/StreamSplicing_1.xml']}]}], u'modelName': [u'UE55MU6172'], u'iconList': [{u'icon': [{u'mimetype': [u'image/jpeg'], u'width': [u'48'], u'depth': [u'24'], u'url': [u'/icon_SML.jpg'], u'height': [u'48']}, {u'mimetype': [u'image/jpeg'], u'width': [u'120'], u'depth': [u'24'], u'url': [u'/icon_LRG.jpg'], u'height': [u'120']}, {u'mimetype': [u'image/png'], u'width': [u'48'], u'depth': [u'24'], u'url': [u'/icon_SML.png'], u'height': [u'48']}, {u'mimetype': [u'image/png'], u'width': [u'120'], u'depth': [u'24'], u'url': [u'/icon_LRG.png'], u'height': [u'120']}]}], u'dlna:X_DLNADOC': [u'DMR-1.50'], u'df:X_deviceCategory': [u'Display.TV.LCD Multimedia.DMR'], u'serialNumber': [u'0AGC3SBJA00450F'], u'pnpx:X_compatibleId': [u'MS_DigitalMediaDeviceClass_DMR_V001'], u'sec:ProductCap': [u'Tizen,Y2017,WebURIPlayable,NavigateInPause,ScreenMirroringP2PMAC=86:c0:ef:47:ee:85,UHD_SCREEN,SerialNumber=0AGC3SBJA00450F,vdProductType=TV,OCF=1'], u'modelNumber': [u'AllShare1.0'], u'deviceType': [u'urn:schemas-upnp-org:device:MediaRenderer:1'], u'friendlyName': [u'[TV] Samsung 6 Series (55)'], u'modelURL': [u'http://www.samsung.com/sec'], u'modelDescription': [u'Samsung TV DMR'], u'UDN': [u'uuid:aadd248e-7d49-4a7b-844f-a8b4f999fe69'], u'pnpx:X_hardwareId': [u'VEN_0105&DEV_VD0001'], u'manufacturer': [u'Samsung Electronics']}], u'specVersion': [{u'major': [u'1'], u'minor': [u'0']}]}]}
INFO:DlnapDevice:friendlyName: [TV] Samsung 6 Series (55)
INFO:DlnapDevice:control_url: /upnp/control/AVTransport1
INFO:DlnapDevice:rendering_control_url: /upnp/control/RenderingControl1
INFO:DlnapDevice:=> Initialization completed
[TV] Samsung 6 Series (55) @ 192.168.1.211
DEBUG:DlnapDevice:POST /upnp/control/RenderingControl1 HTTP/1.1
User-Agent: ./dlnap.py/0.15
Accept: */*
Content-Type: text/xml; charset="utf-8"
HOST: 192.168.1.211:9197
Content-Length: 449
SOAPACTION: "urn:schemas-upnp-org:service:RenderingControl:1#SetMute"
Connection: close
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1">
<InstanceID>0</InstanceID><DesiredMute>1</DesiredMute><Channel>Master</Channel>
</u:SetMute>
</s:Body>
</s:Envelope>
ERROR:root:Invalid Args
Same as for available actions: test.py
(400, 'Bad Request')
<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>402</errorCode><errorDescription>Invalid Args</errorDescription></UPnPError></detail></s:Fault></s:Body></s:Envelope>
Any idea on howto the enable the port?
Tested Samsung QLED Q7F today with the default component settings,
media_player.turn_off,
media_player.turn_on ( wake on lan ) ,
media_player.volume_down
media_player.volume_up
works fine.
Configuration yaml:
# Samsung TV
media_player:
- platform: samsungtv
host: 192.168.1.n
port: 8001
name: Bed Room TV
timeout: 5
turn_on_action:
service: wake_on_lan.send_magic_packet
data:
mac: 2n:3n:5n:Cn:Bn:5n
Switches yaml:
- platform: wake_on_lan
host: 192.168.1.n
name: Bed Room TV
mac_address: “2n:3n:5n:Cn:Bn:5n”
turn_off:
service: media_player.turn_off
entity_id: mediaplayer.bed_room_tv
Automation:
-
data:
entity_id: switch.bed_room_tv
service: switch.turn_on -
data:
entity_id: media_player.bed_room_tv
service: media_player.volume_up
alias: Home TV On -
action:
- data:
entity_id: media_player.bed_room_tv
service: media_player.turn_off
alias: Away TV Off
- data:
Hi guys
I bought a 55mu6120 and I’m running hassio do I need to add anything other than the first posted code?
Is anyone else having issues with power state updates following v 0.62?
Finding the power status isn’t updating; which is resulting in the status being opposite. i.e. when turning the TV off it will suddenly update to show as on.
Yes. Upgrading to 0.62 power status seems doesn’t work anymore. My Tv is Samsung UE46D8000
Same here, i can turn on the tv but not Off, and the status is always off