[Tuto] Controle samsung smart TV

Vous avez créé un script LUA dont vous êtes fier, un .sh génial, un programme Python hors du commun, un Tuto, c'est ici que vous pouvez les partager.
loteran
Messages : 59
Inscription : 29 oct. 2017, 18:59

[Tuto] Controle samsung smart TV

Message par loteran »

Bonjour à tous,

Je parcours le web depuis quelque heures et je ne parviens pas à trouver ce qu'il faut pour prendre le controle de ma TV Samsung UE55JU6500.
J'ai trouvé un script pour controler les tv samsung, mais cela fonctionne uniquement avec les series B,C,D,E,F (tv avant 2015). GitHub, donc rappé pour la mienne.

En l'occurence mon modèle fait parti des smart TV, controlable avec l'application smartview de samsung, aucun pb avec, mais le logiciel n'existe pas pour linux.

N'tétant pas assez expérimenter pour développer un script avec l'api de samsung, je me tourne vers vous, car j'ai trouvé un script mais il est fait pour jeedom et bien sur j'utilise domoticz et je ne vois pas comment l'adapter.

Un peu d'aide serait géniale, merci de vos retours.
ChrisS
Messages : 29
Inscription : 21 févr. 2017, 13:17

Re: Controle samsung smart TV

Message par ChrisS »

Bonjour je suis dans le même cas je voudrais juste trouvé les commandes http à mettre dans les action on ou off pour les commandes basic de ma tv samsung ue55hu7200.

si quelqu'un a ça sous la main merci
Conf Domoticz:
RFXcom, Téléinfo, Netatmo, Milight...
flochocinco
Messages : 26
Inscription : 17 janv. 2018, 16:37

Re: Controle samsung smart TV

Message par flochocinco »

Bonjour,

Avez-vous pu avancer dans vos recherches ?
landaisbenj
Messages : 695
Inscription : 12 mars 2017, 19:24

Re: Controle samsung smart TV

Message par landaisbenj »

TRES INTERRESSANT TOUT CA Moi aussi ca m'irait bien !!!!

Du coup je sais pas si je peux faire quelque chose entre python et domoticz (deja que je comprend tout juste le lua) par contre je pense pouvoir modifier ce script afin qu'on s'en serve plus facilement en mode lancer le script avec un attribu qui serait le nom de la touche, et apres il suffirait de creer un switch selecteur avec l'adresse du script et pour chaque bouton le nom de la touche.

J'ai deja vu sur internet des devices qui utilisait des python et j'ai deja un poil touché au python avec gh mais pas avec domoticz. Je vais voir si je peux nous bidouiller un truc dans le genre.

[EDIT] Car au final le script n'a pas l'air de faire grand chose...
Il créer plusieurs fonction: L'envoi vers la tele, la decloration et l'ouverture d'une connexion et apres il ne fait qu'enchainer plusieur touche...
*emoustillé* depuis le temps que je cherche a controler ma tele samsung !!!

[EDIT] Le probleme c'est que j'ai pas ma tele sous le bras jusqu'a dimanche soir :/ si vous connaissez linux je vais essayé simplement de modifier les script pour une action ou deux et après il faudra vérifier si il fonctionne en dehors de domoticz.
Rpbi3b: Domoticz + Homebridge + Monit + Freebox scripts + Shellinabox; Rpbi2: Jarvis
Domoticz: Derniere stable; RFLINK: Dernière stable; Xiaomi Gateway
flochocinco
Messages : 26
Inscription : 17 janv. 2018, 16:37

Re: Controle samsung smart TV

Message par flochocinco »

Hmm à ta place je testerai l'inverse, à savoir tester le scrpit indépendament de domoticz dans un premier temps.

Pour info les serie H et J semblent differentes et abandonnée par samsung de ce côté là donc je ne sais pas si on peux espèrer grand chose...
https://github.com/Ape/samsungctl/wiki/Supported-Models

Pour ma part j'ai tester pas mal de solutions mais sans succés (samsungctl et iSamsung) avec ma UE55JU6000 :oops: du coup je me lance dans un projet avec LED infrarouge. mais bon c'est pas terriblement WAF comme solution.
landaisbenj
Messages : 695
Inscription : 12 mars 2017, 19:24

Re: Controle samsung smart TV

Message par landaisbenj »

Oui c'est ca. Indepedemment de domoticz. D'abord pour voir si il fonctionne... Apres on aura le temps d'essayer autre chose.
Bon je me suis pas foulé de toute facon...
Donc, j'ai ajouté la gestion d'argument et ensuite j'ai supprimé ce qui n’était pas nécessaire dans son script.

Ce qu'il faut faire c'est créer un fichier

Code : Tout sélectionner

sudo nano /home/pi/test.py
avec le code que je vais vous donner a la fin et en renseignant les parametres de votre tele:
tvip = "ADRESSE_IP_DE_LA_TV"
myip = "ADRESSE_IP de l'equipement qui execute ce code"
mymac = "ADRESSE_MAC de l'equipement qui execute ce code"
tvappstring = "iphone.UE46F6400.iapp.samsung"
Rendre ce script exécutable:

Code : Tout sélectionner

sudo chmod +x /home/pi/test.py
et tester la commande du type:

Code : Tout sélectionner

/home/pi/test.py KEY_LEFT
ou

Code : Tout sélectionner

/home/pi/test.py KEY_POWEROFF 
Dans un premier temps il faudra surement valider la connexion sur la tele (je crois qu'on le fait aussi avec l'application).
Si ca donne le resultat attendu de la touche alors il suffira juste pour l'instant de ce servir de se script avec un script lua dans domoticz.
(evidement on pourra simplifier mais au moins on peut tester...)

Le code:

Code : Tout sélectionner

#!/usr/bin/python
# Title: samsungremote.py
# Author: Asif Iqbal
# Date: 05APR2012
# Info: To send remote control commands to the Samsung tv over LAN
 
import socket
import base64
import time, datetime
import sys
 
tvip = "ADRESSE_IP_DE_LA_TV"
myip = "ADRESSE_IP de l'equipement qui execute ce code"
mymac = "ADRESSE_MAC de l'equipement qui execute ce code"
appstring = "iphone..iapp.samsung" #NE PAS CHANGER#
tvappstring = "iphone.UE46F6400.iapp.samsung" #REFERENCE A CHANGER SUIVANT VOTRE TV#
remotename = "Python Samsung Remote"
 
# Fonction d'envoi
def sendKey(skey, dataSock, appstring):
messagepart3 = chr(0x00) + chr(0x00) + chr(0x00) + chr(len(
base64.b64encode(skey))) + chr(0x00) + base64.b64encode(skey);
part3 = chr(0x00) + chr(len(appstring)) + chr(0x00) \
+ appstring + chr(len(messagepart3)) + chr(0x00) + messagepart3
dataSock.send(part3);
 
#Déclaration du socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((tvip, 55000))
 
#Initiation de la connexion
ipencoded = base64.b64encode(myip)
macencoded = base64.b64encode(mymac)
messagepart1 = chr(0x64) + chr(0x00) + chr(len(ipencoded)) \
+ chr(0x00) + ipencoded + chr(len(macencoded)) + chr(0x00) \
+ macencoded + chr(len(base64.b64encode(remotename))) + chr(0x00) \
+ base64.b64encode(remotename)
 
part1 = chr(0x00) + chr(len(appstring)) + chr(0x00) + appstring \
+ chr(len(messagepart1)) + chr(0x00) + messagepart1
sock.send(part1)
 
messagepart2 = chr(0xc8) + chr(0x00)
part2 = chr(0x00) + chr(len(appstring)) + chr(0x00) + appstring \
+ chr(len(messagepart2)) + chr(0x00) + messagepart2
sock.send(part2)
 
#Test
sendKey(sys.argv[1],sock,tvappstring) 

# Fermeture du socket
sock.close()
Si tout ca fonctionne alors le script sera accessible depuis domoticz.
Je n'ai rajouté que la gestion d'un argument xD

[EDIT] j'ai oublié de mettre les clefs:

Code : Tout sélectionner

#KEY_0 --TOUCHE 0
#KEY_1 --TOUCHE 1
#KEY_2 --TOUCHE 2
#KEY_3 --TOUCHE 3
#KEY_4 --TOUCHE 4
#KEY_5 --TOUCHE 5
#KEY_6 --TOUCHE 6
#KEY_7 --TOUCHE 7
#KEY_8 --TOUCHE 8
#KEY_9 --TOUCHE 9
#KEY_UP --CROIX HAUT
#KEY_DOWN --CROIX BAS
#KEY_LEFT --CROIX GAUCHE
#KEY_RIGHT --CROIX DROITE
#KEY_MENU --TOUCHE MENU
#KEY_PRECH --TOUCHE PRE-CH
#KEY_GUIDE --TOUCHE GUIDE
#KEY_INFO --TOUCHE INFO
#KEY_RETURN --TOUCHE RETURN
#KEY_CH_LIST --TOUCHE CH LIST
#KEY_EXIT --TOUCHE EXIT
#KEY_ENTER --CROIX ENTER
#KEY_SOURCE --TOUCHE SOURCE
#KEY_AD #KEY_PLAY --TOUCHE
#KEY_PAUSE --TOUCHE PAUSE
#KEY_MUTE --TOUCHE MUTE
#KEY_PICTURE_SIZE --
#KEY_VOLUP --TOUCHE VOL +
#KEY_VOLDOWN --TOUCHE VOL -
#KEY_TOOLS --TOUCHE TOOLS
#KEY_POWEROFF --TOUCHE POWEROFF
#KEY_CHUP --TOUCHE PROG +
#KEY_CHDOWN --TOUCHE PROG -
#KEY_CONTENTS --TOUCHE SMART HUB
#KEY_W_LINK #Media P
#KEY_RSS #Internet
#KEY_MTS #Dual
#KEY_CAPTION #Subt
#KEY_REWIND --TOUCHE <<
#KEY_FF --TOUCHE >>
#KEY_REC
#KEY_STOP --TOUCHE STOP
Dernière modification par landaisbenj le 11 févr. 2018, 20:47, modifié 2 fois.
Rpbi3b: Domoticz + Homebridge + Monit + Freebox scripts + Shellinabox; Rpbi2: Jarvis
Domoticz: Derniere stable; RFLINK: Dernière stable; Xiaomi Gateway
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: Controle samsung smart TV

Message par thier »

Je ne sais pas si ça va vous aider mais voila pour ceux qui cherchent toutes les commandes qui peuvent être passée en lua avec une passerelle harmonyHub sur ma télé samsung UE46F6500SS

Code : Tout sélectionner

[],"device":[{"label":"TV Samsung","deviceAddedDate":"\/Date(1431677193660+0000)\/","ControlPort":1,"deviceProfileUri":"svcs.myharmony.com\/res\/device\/27244174-xxxxxxxxxxxxxxxxxxxxxxxxxxx=","manufacturer":"Samsung","icon":"1","suggestedDisplay":"DEFAULT","deviceTypeDisplayName":"Television","powerFeatures":{"PowerOnActions":[{"__type":"IRPressAction","IRCommandName":"PowerOn","Order":0,"Duration":null,"ActionId":0}],"PowerOffActions":[{"__type":"IRPressAction","IRCommandName":"PowerOff","Order":0,"Duration":null,"ActionId":0}]},"Capabilities":[1,2,3,5,8,9,10,16,24,47,6],"controlGroup":[{"name":"Power","function":[{"action":"{\"command\":\"PowerOff\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"PowerOff","label":"Power Off"},{"action":"{\"command\":\"PowerOn\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"PowerOn","label":"Power On"},{"action":"{\"command\":\"PowerToggle\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"PowerToggle","label":"Power Toggle"}]},{"name":"NumericBasic","function":[{"action":"{\"command\":\"0\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Number0","label":"0"},{"action":"{\"command\":\"1\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Number1","label":"1"},{"action":"{\"command\":\"2\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Number2","label":"2"},{"action":"{\"command\":\"3\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Number3","label":"3"},{"action":"{\"command\":\"4\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Number4","label":"4"},{"action":"{\"command\":\"5\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Number5","label":"5"},{"action":"{\"command\":\"6\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Number6","label":"6"},{"action":"{\"command\":\"7\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Number7","label":"7"},{"action":"{\"command\":\"8\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Number8","label":"8"},{"action":"{\"command\":\"9\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Number9","label":"9"}]},{"name":"Volume","function":[{"action":"{\"command\":\"Mute\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Mute","label":"Mute"},{"action":"{\"command\":\"VolumeDown\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"VolumeDown","label":"Volume Down"},{"action":"{\"command\":\"VolumeUp\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"VolumeUp","label":"Volume Up"}]},{"name":"Channel","function":[{"action":"{\"command\":\"ChannelPrev\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"PrevChannel","label":"Prev Channel"},{"action":"{\"command\":\"ChannelDown\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"ChannelDown","label":"Channel Down"},{"action":"{\"command\":\"ChannelUp\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"ChannelUp","label":"Channel Up"}]},{"name":"NavigationBasic","function":[{"action":"{\"command\":\"DirectionDown\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"DirectionDown","label":"Direction Down"},{"action":"{\"command\":\"DirectionLeft\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"DirectionLeft","label":"Direction Left"},{"action":"{\"command\":\"DirectionRight\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"DirectionRight","label":"Direction Right"},{"action":"{\"command\":\"DirectionUp\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"DirectionUp","label":"Direction Up"},{"action":"{\"command\":\"Select\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Select","label":"Select"}]},{"name":"TransportBasic","function":[{"action":"{\"command\":\"Stop\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Stop","label":"Stop"},{"action":"{\"command\":\"Play\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Play","label":"Play"},{"action":"{\"command\":\"Rewind\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Rewind","label":"Rewind"},{"action":"{\"command\":\"Pause\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Pause","label":"Pause"},{"action":"{\"command\":\"FastForward\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"FastForward","label":"Fast Forward"}]},{"name":"TransportRecording","function":[{"action":"{\"command\":\"Record\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Record","label":"Record"}]},{"name":"NavigationDVD","function":[{"action":"{\"command\":\"Return\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Return","label":"Return"},{"action":"{\"command\":\"Menu\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Menu","label":"Menu"},{"action":"{\"command\":\"Subtitle\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Subtitle","label":"Subtitle"}]},{"name":"Teletext","function":[{"action":"{\"command\":\"Teletext\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Teletext","label":"Teletext"}]},{"name":"NavigationDSTB","function":[{"action":"{\"command\":\"C\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"C","label":"C"},{"action":"{\"command\":\"B\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"B","label":"B"},{"action":"{\"command\":\"D\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"D","label":"D"},{"action":"{\"command\":\"A\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"A","label":"A"}]},{"name":"ColoredButtons","function":[{"action":"{\"command\":\"Green\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Green","label":"Green"},{"action":"{\"command\":\"Red\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Red","label":"Red"},{"action":"{\"command\":\"Blue\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Blue","label":"Blue"},{"action":"{\"command\":\"Yellow\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Yellow","label":"Yellow"}]},{"name":"NavigationExtended","function":[{"action":"{\"command\":\"Guide\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Guide","label":"Guide"},{"action":"{\"command\":\"Info\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Info","label":"Info"},{"action":"{\"command\":\"Exit\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Exit","label":"Exit"}]},{"name":"GoogleTVNavigation","function":[{"action":"{\"command\":\"Netflix\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Netflix","label":"Netflix"}]},{"name":"Miscellaneous","function":[{"action":"{\"command\":\"3D\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"3D","label":"3D"},{"action":"{\"command\":\"AD\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"AD","label":"AD"},{"action":"{\"command\":\"ChannelList\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"ChannelList","label":"ChannelList"},{"action":"{\"command\":\"E-Manual\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"E-Manual","label":"E-Manual"},{"action":"{\"command\":\"ExitApp\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"ExitApp","label":"ExitApp"},{"action":"{\"command\":\"InputAv\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"InputAv","label":"InputAv"},{"action":"{\"command\":\"InputComponent\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"InputComponent","label":"InputComponent"},{"action":"{\"command\":\"InputExt\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"InputExt","label":"InputExt"},{"action":"{\"command\":\"InputHdmi1\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"InputHdmi1","label":"InputHdmi1"},{"action":"{\"command\":\"InputHdmi2\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"InputHdmi2","label":"InputHdmi2"},{"action":"{\"command\":\"InputHdmi3\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"InputHdmi3","label":"InputHdmi3"},{"action":"{\"command\":\"InputHdmi4\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"InputHdmi4","label":"InputHdmi4"},{"action":"{\"command\":\"InputTv\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"InputTv","label":"InputTv"},{"action":"{\"command\":\"InputUsb\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"InputUsb","label":"InputUsb"},{"action":"{\"command\":\"SmartHub\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"SmartHub","label":"SmartHub"},{"action":"{\"command\":\"Source\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Source","label":"Source"},{"action":"{\"command\":\"Tools\",\"type\":\"IRCommand\",\"deviceId\":\"27244174\"}","name":"Tools","label":"Tools"}]}],"DongleRFID":0,"IsKeyboardAssociated":false,"model":"UE46F6500SS","type":"Television","id":"27244174","Transport":1,"isManualPower":"false"},{"label":"AMPLI Sony","deviceAddedDate":"\/Date(1431677326090+0000)\/","ControlPort":1,"deviceProfileUri":"svcs.myharmony.com\/res\/device\/27244180
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
Répondre