0

Hyperion Lightberry

= Son ambilight (lightberry) à la maison sur osmc =

 

logo-bez-tla-300x144czarne

Bonjour, (Article en cours de rédaction)

Voici un billet pour vous présenter comment installer le lightberry chez vous.

Le but est de profiter de l’équivalent du système ambilight des téléviseurs Philips sur n’importe quelle télévision.

En plus d’être joli, cet éclairage apporte plusieurs avantages:

  • une meilleure immersion dans le film affiché. Dans le noir en particulier, il crée une atmosphère qui vous plonge encore davantage dans le film d’horreur, d’action ou le drame que vous êtes en train de visionner.
  • l’image « sort » du cadre de l’écran, donnant l’impression d’une image libérée de ses contraintes et de ses bords. On a l’impression d’avoir une image plus grande
  • enfin, le halo lumineux adoucit l’image, en réduisant l’agressivité, et partant de là, la fatigue oculaire. Il réduit le contraste entre l’image du téléviseur et le mur qui supporte l’écran, si bien que l’oeil s’adapte plus facilement aux changements d’images.

voici comment faire et ce dont vous avez besoin.

Il vous faudra commander le kit HD ici :

http://lightberry.eu/

vous y trouverez des vidéos de ce que donne le système sur une télévision.

J’ai commandé ce produit:

Ensuite il faut

  • Une télévision ! (on ne s’en doutait pas …)
  • Un Raspberry Pi avec les câbles d’alimentation, HDMI et réseau
  • Une carte SD
  • Installer OSMC sur la carte SD

 

Présentation

J’ai récupéré des photos des équipements sur l’excellent blog domandoo car tout est maintenant encastré chez moi:

 

Le système pour le Lightberry HD a été revu en grande partie. Nous avons maintenant un ruban led plat, plus classique, toujours le petit boitier noir de conversion, une alimentation électrique, un cable USB, et des supports pour le ruban à fixer derrière la TV.

guide_lightberry_hd_usb_2

14 supports en plastique de ce type sont fournis:

guide_lightberry_hd_usb_4

Ils seront à placer de part et d’autre de l’écran afin de maintenir le ruban led perpendiculaire à la TV. Nous verrons cela un peu plus loin en détail.

Le ruban led sera ensuite branché sur ce petit boitier noir:

guide_lightberry_hd_usb_5

Lui même relié à l’alimentation,

guide_lightberry_hd_usb_6

Et à un cable USB, fourni, d’une longueur d’environ 1,8m. L’autre extrémité sera à brancher sur le Raspberry Pi.

guide_lightberry_hd_usb_7

Enfin, le ruban led en lui même:

guide_lightberry_hd_usb_8

Ce nouveau ruban est plus lumineux, et dispose surtout de beaucoup plus de leds, 30 leds au mètre contre 12 seulement sur l’ancien modèle.

guide_lightberry_hd_usb_9

 

Installation du Lightberry

Je vais vous présenter ici comment installer physiquement le produit sur votre télévision.

Il vous faudra démonter votre Télévision du Mur si elle est fixée.

Pour ma part, j’ai fixé ma télévision sur un support mural et un mur placo.

La télévision est une Panasonic ST60 une référence pour les amoureux de cinema, cf le test HDFEVER

Je prends soin de préparer le support pour faire reposer ma télévision une fois démontée, ici ma télé repose sur le revètement du canapé

Je vais ensuite commencer par fixer les supports plastiques tout autour de la télé en m’éloignant un peu du bord de facon à ne pas voir apparaitre les led sur les tranches. Alors ici je vous l’accorde ce n’est pas super propre mais j’ai pris soin ensuite de faire en sorte que tout ca soit un peu plus tendu.

 

 

IMG_2078

Pour les composants, tout est fixé avec du sckotch double face, tout en évitant de boucher les aérations.

 

 

IMG_2079

Vous observez que j’ai laissé l’enrouleur.

La raison ? baht j’ai payé 5m de cables je veux pouvoir les garder pour une prochaine télé, si je dois la changer vers plus grand.
Vous verez par la suite qu’il n’est pas nécessaire de couper le ruban led car nous pouvons désactiver les leds inutilisées via un petit soft appelé Hyperion.

Le cable USB passent dans la cloison placo avec le cordon HDMI pour rejoindre la rasberry pi 2 qui est cachée ici dans le meuble.

IMG_2172
Le signal video est envoyé depuis le hdmi de la pi vers une entrée de l’ampli home cinema.

La sortie de l’ampli home cinéma est branché à la télé.
La télévision et l’ampli sont compatible HDMI CEC ainsi que la pi.

image ampliIMG_2171-1

De fait il nous ai possible de controler tout nos équipement via la télécommande TV classique.

image télécommande

IMG_2173

Résultat monté:

IMG_2165

 

Configuration

Rédaction en cours

On va aborder le point de la configuration.

Ici on se base sur une distribution OSMC. ce qui vous obligeras à faire des manipulations au niveau os en se connectant en ssh.

Avec putty, veuillez vous connecter à votre raspberry.

Si vous êtes dans le m^me cas que moi et que vous avez opté pour le modèle lighberry HD avec le connecteur USB alors vous n’avez plus qu’à suivre mes instructions.installez le script suivant:

wget -nv -N https://raw.github.com/tvdzwan/hyperion/master/bin/install_hyperion.sh && chmod +x install_hyperion.sh sudo sh ./install_hyperion.sh USB

une fois hyperion installé on va configurer celui ci mais à la main.

Hyperion au démarrage

apt-get install psmisc

nous allons créer un fichier hyperion.service dans /etc/systemd/system  dont voici le contenu:

avec un vi ou nano editez le fichier.

[Unit]
Description=Hyperion
[Service]
Type=simple
User=osmc
Group=osmc
UMask=007
ExecStart=/opt/hyperion/bin/hyperiond /etc/hyperion.config.json
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
TimeoutStopSec=10
 
[Install]
WantedBy=multi-user.target

ensuite on start le service 

/opt/hyperion/bin/hyperiond /etc/hyperion.config.json

On active ensuite le service au démarrage.


sudo systemctl enable hyperion

 

Configurer le ruban de couleur.

vous pouvez générer ce fichier à l’aide de HyperCon, bien plus complet et vous permettant de personnaliser votre fichier en correspondant au mieux à votre installation.

 

hypercon

Une fois le fichier hyperion.config.json en votre possession, vous devrez le mettre dans le répertoire /etc de votre carte SD et redémarrer votre Raspberry Pi avec la commande sudo reboot pour qu’il soit pris en compte.

Mon fichier ici est spécifique à mon installation, il défini mon nombre de led et dans quel sens j’i installé mon ruban et ou il commence.
Ce qui vous obliges à générer le votre avec Hypercon.

En revanche vous pouvez copier la partie device de mon fichier qui spécifie la configuration à utiliser dans le cas ou vous utilisez le modèle lightberry HD avec USB :

"device" :
{
"name"       : "MyPi",
"type"       : "adalightapa102",
"output"     : "/dev/ttyACM0",
"colorOrder" : "bgr"
},

Je vous conseils aussi de récupérer mes paramètres colors de mon fichier.

Je me suis inspiré de plusieurs tests et retours sur les forum pour récupérer le meilleur rendu lumière qui colle le plus à l’image.

 

Voici le fichier complet :

// Automatically generated configuration file for 'Hyperion daemon'
// Generated by: HyperCon (The Hyperion deamon configuration file builder

{
/// Device configuration contains the following fields:
/// * 'name'       : The user friendly name of the device (only used for display purposes)
/// * 'type'       : The type of the device or leds (known types for now are
/// APA102, Adalight, AmbiLed, Atmo, Hyperion-USBASP-WS2801, Hyperion-USBASP-WS2812, Lightberry, Lightpack, LPD6803, LPD8806, Multi-Lightpack, P9813, Paintpack, PhilipsHUE, PiBlaster, SEDU, Test, ThinkerForge, TPM2, WS2801, WS2812b, None)
/// * [device type specific configuration]
/// * 'colorOrder' : The order of the color bytes ('rgb', 'rbg', 'bgr', etc.).
"device" :
{
"name"       : "MyPi",
"type"       : "adalightapa102",
"output"     : "/dev/ttyACM0",
"colorOrder" : "bgr"
},
/// Color manipulation configuration used to tune the output colors to specific surroundings.
/// The configuration contains a list of color-transforms. Each transform contains the
/// following fields:
///  * 'id'   : The unique identifier of the color transformation (eg 'device_1')    ///  * 'leds' : The indices (or index ranges) of the leds to which this color transform applies
///             (eg '0-5, 9, 11, 12-17'). The indices are zero based.    ///  * 'hsv' : The manipulation in the Hue-Saturation-Value color domain with the following
///            tuning parameters:
///            - 'saturationGain'  The gain adjustement of the saturation
///            - 'valueGain'       The gain adjustement of the value
///  * 'red'/'green'/'blue' : The manipulation in the Red-Green-Blue color domain with the
///                           following tuning parameters for each channel:
///            - 'threshold'       The minimum required input value for the channel to be on
///                                (else zero)
///            - 'gamma'           The gamma-curve correction factor
///            - 'blacklevel'      The lowest possible value (when the channel is black)
///            - 'whitelevel'      The highest possible value (when the channel is white)
///
/// Next to the list with color transforms there is also a smoothing option.
///  * 'smoothing' : Smoothing of the colors in the time-domain with the following tuning
///                  parameters:
///            - 'type'            The type of smoothing algorithm ('linear' or 'none')
///            - 'time_ms'         The time constant for smoothing algorithm in milliseconds
///            - 'updateFrequency' The update frequency of the leds in Hz
///            - 'updateDelay'     The delay of the output to leds (in periods of smoothing)
"color" :
{
"transform" :
[
{
"id"   : "default",
"leds" : "*",
"hsv" :
{
"saturationGain" : 1.0000,
"valueGain"      : 1.0000
},
"red" :
{
"threshold"  : 0.0500,
"gamma"      : 1.8000,
"blacklevel" : 0.0000,
"whitelevel" : 1.0000
},
"green" :
{
"threshold"  : 0.0500,
"gamma"      : 1.8000,
"blacklevel" : 0.0000,
"whitelevel" : 1.0000
},
"blue" :
{
"threshold"  : 0.0500,
"gamma"      : 1.8000,
"blacklevel" : 0.0000,
"whitelevel" : 1.0000
}
}
],
"smoothing" :
{
"type"            : "linear",
"time_ms"         : 100,
"updateFrequency" : 20.0000,
"updateDelay"     : 0
}
},
/// The black border configuration, contains the following items:
///  * enable    : true if the detector should be activated
///  * threshold : Value below which a pixel is regarded as black (value between 0.0 and 1.0)
"blackborderdetector" :
{
"enable" : true,
"threshold" : 0.01
},

/// The configuration of the effect engine, contains the following items:
///  * paths        : An array with absolute location(s) of directories with effects
///  * bootsequence : The effect selected as 'boot sequence'
"effects" :
{
"paths" :
[
"/opt/hyperion/effects"
]
},

"bootsequence" :
{
"effect" : "Rainbow swirl fast",
"duration_ms" : 3000
},

///  The configuration for the frame-grabber, contains the following items:
///   * width        : The width of the grabbed frames [pixels]
///   * height       : The height of the grabbed frames [pixels]
///   * frequency_Hz : The frequency of the frame grab [Hz]
"framegrabber" :
{
"width" : 64,
"height" : 64,
"frequency_Hz" : 10.0
},

/// The configuration of the XBMC connection used to enable and disable the frame-grabber. Contains the following fields:
///  * xbmcAddress       : The IP address of the XBMC-host
///  * xbmcTcpPort       : The TCP-port of the XBMC-server
///  * grabVideo         : Flag indicating that the frame-grabber is on(true) during video playback
///  * grabPictures      : Flag indicating that the frame-grabber is on(true) during picture show
///  * grabAudio         : Flag indicating that the frame-grabber is on(true) during audio playback
///  * grabMenu          : Flag indicating that the frame-grabber is on(true) in the XBMC menu
///  * grabScreensaver   : Flag indicating that the frame-grabber is on(true) when XBMC is on screensaver
///  * enable3DDetection : Flag indicating that the frame-grabber should switch to a 3D compatible modus if a 3D video is playing
"xbmcVideoChecker" :
{
"xbmcAddress" : "192.168.1.4",
"xbmcTcpPort" : 9090,
"grabVideo" : true,
"grabPictures" : true,
"grabAudio" : true,
"grabMenu" : true,
"grabScreensaver" : true,
"enable3DDetection" : true
},

/// The configuration of the Json server which enables the json remote interface
///  * port : Port at which the json server is started
"jsonServer" :
{
"port" : 19444
},

/// The configuration of the Proto server which enables the protobuffer remote interface
///  * port : Port at which the protobuffer server is started
"protoServer" :
{
"port" : 19445
},

/// The configuration of the boblight server which enables the boblight remote interface
///  * port : Port at which the boblight server is started
//     "boblightServer" :
//     {
//         "port" : 19333
//     },

/// Configuration for the embedded V4L2 grabber
///  * device          : V4L2 Device to use [default="/dev/video0"]
///  * input           : V4L2 input to use [default=0]
///  * standard        : Video standard (no-change/PAL/NTSC) [default="no-change"]
///  * width                : V4L2 width to set [default=-1]
///  * height               : V4L2 height to set [default=-1]
///  * frameDecimation      : Frame decimation factor [default=2]
///  * sizeDecimation       : Size decimation factor [default=8]
///  * priority             : Hyperion priority channel [default=800]
///  * mode                 : 3D mode to use 2D/3DSBS/3DTAB (note: no autodetection) [default="2D"]
///  * cropLeft             : Cropping from the left [default=0]
///  * cropRight            : Cropping from the right [default=0]
///  * cropTop              : Cropping from the top [default=0]
///  * cropBottom           : Cropping from the bottom [default=0]
///  * redSignalThreshold   : Signal threshold for the red channel between 0.0 and 1.0 [default=0.0]
///  * greenSignalThreshold : Signal threshold for the green channel between 0.0 and 1.0 [default=0.0]
///  * blueSignalThreshold  : Signal threshold for the blue channel between 0.0 and 1.0 [default=0.0]
///"grabber-v4l2" :
///    {
///    "device" : "/dev/video0",
///"input" : 0,
///    "standard" : "no-change",
///"width" : -1,
///"height" : -1,
///    "frameDecimation" : 2,
///    "sizeDecimation" : 8,
///    "priority" : 800,
///    "mode" : "2D",
///    "cropLeft" : 0,
///    "cropRight" : 0,
///    "cropTop" : 0,
///    "cropBottom" : 0,
///    "redSignalThreshold" : 0.0,
///    "greenSignalThreshold" : 0.0,
///    "blueSignalThreshold" : 0.0
///},
"leds" :
[
{
"index" : 0,
"hscan" : { "minimum" : 0.6000, "maximum" : 0.6333 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 1,
"hscan" : { "minimum" : 0.5667, "maximum" : 0.6000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 2,
"hscan" : { "minimum" : 0.5333, "maximum" : 0.5667 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 3,
"hscan" : { "minimum" : 0.5000, "maximum" : 0.5333 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 4,
"hscan" : { "minimum" : 0.4667, "maximum" : 0.5000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 5,
"hscan" : { "minimum" : 0.4333, "maximum" : 0.4667 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 6,
"hscan" : { "minimum" : 0.4000, "maximum" : 0.4333 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 7,
"hscan" : { "minimum" : 0.3667, "maximum" : 0.4000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 8,
"hscan" : { "minimum" : 0.3333, "maximum" : 0.3667 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 9,
"hscan" : { "minimum" : 0.3000, "maximum" : 0.3333 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 10,
"hscan" : { "minimum" : 0.2667, "maximum" : 0.3000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 11,
"hscan" : { "minimum" : 0.2333, "maximum" : 0.2667 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 12,
"hscan" : { "minimum" : 0.2000, "maximum" : 0.2333 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 13,
"hscan" : { "minimum" : 0.1667, "maximum" : 0.2000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 14,
"hscan" : { "minimum" : 0.1333, "maximum" : 0.1667 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 15,
"hscan" : { "minimum" : 0.1000, "maximum" : 0.1333 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 16,
"hscan" : { "minimum" : 0.0667, "maximum" : 0.1000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 17,
"hscan" : { "minimum" : 0.0333, "maximum" : 0.0667 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 18,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0333 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 19,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 20,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0588 }
},
{
"index" : 21,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.0588, "maximum" : 0.1176 }
},
{
"index" : 22,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.1176, "maximum" : 0.1765 }
},
{
"index" : 23,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.1765, "maximum" : 0.2353 }
},
{
"index" : 24,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.2353, "maximum" : 0.2941 }
},
{
"index" : 25,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.2941, "maximum" : 0.3529 }
},
{
"index" : 26,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.3529, "maximum" : 0.4118 }
},
{
"index" : 27,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.4118, "maximum" : 0.4706 }
},
{
"index" : 28,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.4706, "maximum" : 0.5294 }
},
{
"index" : 29,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.5294, "maximum" : 0.5882 }
},
{
"index" : 30,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.5882, "maximum" : 0.6471 }
},
{
"index" : 31,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.6471, "maximum" : 0.7059 }
},
{
"index" : 32,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.7059, "maximum" : 0.7647 }
},
{
"index" : 33,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.7647, "maximum" : 0.8235 }
},
{
"index" : 34,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.8235, "maximum" : 0.8824 }
},
{
"index" : 35,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.8824, "maximum" : 0.9412 }
},
{
"index" : 36,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.9412, "maximum" : 1.0000 }
},
{
"index" : 37,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 38,
"hscan" : { "minimum" : 0.0000, "maximum" : 0.0333 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 39,
"hscan" : { "minimum" : 0.0333, "maximum" : 0.0667 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 40,
"hscan" : { "minimum" : 0.0667, "maximum" : 0.1000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 41,
"hscan" : { "minimum" : 0.1000, "maximum" : 0.1333 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 42,
"hscan" : { "minimum" : 0.1333, "maximum" : 0.1667 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 43,
"hscan" : { "minimum" : 0.1667, "maximum" : 0.2000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 44,
"hscan" : { "minimum" : 0.2000, "maximum" : 0.2333 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 45,
"hscan" : { "minimum" : 0.2333, "maximum" : 0.2667 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 46,
"hscan" : { "minimum" : 0.2667, "maximum" : 0.3000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 47,
"hscan" : { "minimum" : 0.3000, "maximum" : 0.3333 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 48,
"hscan" : { "minimum" : 0.3333, "maximum" : 0.3667 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 49,
"hscan" : { "minimum" : 0.3667, "maximum" : 0.4000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 50,
"hscan" : { "minimum" : 0.4000, "maximum" : 0.4333 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 51,
"hscan" : { "minimum" : 0.4333, "maximum" : 0.4667 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 52,
"hscan" : { "minimum" : 0.4667, "maximum" : 0.5000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 53,
"hscan" : { "minimum" : 0.5000, "maximum" : 0.5333 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 54,
"hscan" : { "minimum" : 0.5333, "maximum" : 0.5667 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 55,
"hscan" : { "minimum" : 0.5667, "maximum" : 0.6000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 56,
"hscan" : { "minimum" : 0.6000, "maximum" : 0.6333 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 57,
"hscan" : { "minimum" : 0.6333, "maximum" : 0.6667 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 58,
"hscan" : { "minimum" : 0.6667, "maximum" : 0.7000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 59,
"hscan" : { "minimum" : 0.7000, "maximum" : 0.7333 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 60,
"hscan" : { "minimum" : 0.7333, "maximum" : 0.7667 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 61,
"hscan" : { "minimum" : 0.7667, "maximum" : 0.8000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 62,
"hscan" : { "minimum" : 0.8000, "maximum" : 0.8333 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 63,
"hscan" : { "minimum" : 0.8333, "maximum" : 0.8667 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 64,
"hscan" : { "minimum" : 0.8667, "maximum" : 0.9000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 65,
"hscan" : { "minimum" : 0.9000, "maximum" : 0.9333 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 66,
"hscan" : { "minimum" : 0.9333, "maximum" : 0.9667 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 67,
"hscan" : { "minimum" : 0.9667, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 68,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.9200, "maximum" : 1.0000 }
},
{
"index" : 69,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.9412, "maximum" : 1.0000 }
},
{
"index" : 70,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.8824, "maximum" : 0.9412 }
},
{
"index" : 71,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.8235, "maximum" : 0.8824 }
},
{
"index" : 72,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.7647, "maximum" : 0.8235 }
},
{
"index" : 73,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.7059, "maximum" : 0.7647 }
},
{
"index" : 74,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.6471, "maximum" : 0.7059 }
},
{
"index" : 75,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.5882, "maximum" : 0.6471 }
},
{
"index" : 76,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.5294, "maximum" : 0.5882 }
},
{
"index" : 77,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.4706, "maximum" : 0.5294 }
},
{
"index" : 78,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.4118, "maximum" : 0.4706 }
},
{
"index" : 79,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.3529, "maximum" : 0.4118 }
},
{
"index" : 80,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.2941, "maximum" : 0.3529 }
},
{
"index" : 81,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.2353, "maximum" : 0.2941 }
},
{
"index" : 82,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.1765, "maximum" : 0.2353 }
},
{
"index" : 83,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.1176, "maximum" : 0.1765 }
},
{
"index" : 84,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.0588, "maximum" : 0.1176 }
},
{
"index" : 85,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0588 }
},
{
"index" : 86,
"hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 87,
"hscan" : { "minimum" : 0.9667, "maximum" : 1.0000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 88,
"hscan" : { "minimum" : 0.9333, "maximum" : 0.9667 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 89,
"hscan" : { "minimum" : 0.9000, "maximum" : 0.9333 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 90,
"hscan" : { "minimum" : 0.8667, "maximum" : 0.9000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 91,
"hscan" : { "minimum" : 0.8333, "maximum" : 0.8667 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 92,
"hscan" : { "minimum" : 0.8000, "maximum" : 0.8333 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 93,
"hscan" : { "minimum" : 0.7667, "maximum" : 0.8000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 94,
"hscan" : { "minimum" : 0.7333, "maximum" : 0.7667 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 95,
"hscan" : { "minimum" : 0.7000, "maximum" : 0.7333 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 96,
"hscan" : { "minimum" : 0.6667, "maximum" : 0.7000 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
},
{
"index" : 97,
"hscan" : { "minimum" : 0.6333, "maximum" : 0.6667 },
"vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
}
],

"endOfJson" : "endOfJson"
}

Vous pouvez maintenant tester avec la commande suivante si les leds s’allument en rouge pendant 5 secondes :

hyperion-remote --priority 50 --color red --duration 5000

vous devriez obtenir un changement de couleur et un retour console :

Connected to localhost:19444
Set color to 255 0 0

Configurer un ou plusieurs boutons sur votre télécommande pour gérer hyperion

After that we copy the colourswitch.py, off.py and switch.py to /home/osmc/hyperion

off.py (one button on my Harmony Remote to kill all lights in the house, including the Hyperion deamon)

import subprocess

pid = subprocess.Popen('pidof hyperiond', shell=True, close_fds=True, stdout=subprocess.PIPE)

try:
    if pid.stdout.readlines():
        subprocess.Popen('killall hyperiond', shell=True)
    else:
        subprocess.Popen('killall hyperiond', shell=True)
except Exception, e:
    pass

switch.py (to turn ambilights on/off and off/on with single button

import subprocess

pid = subprocess.Popen('pidof hyperiond', shell=True, close_fds=True, stdout=subprocess.PIPE)

try:
    if pid.stdout.readlines():
        subprocess.Popen('killall hyperiond', shell=True)
    else:
        subprocess.Popen('/opt/hyperion/bin/hyperiond /etc/hyperion.config.json </dev/null >/dev/null 2>&1 &', shell=True)
except Exception, e:
    pass

colourswitch.py (to get different colours while pusing the same button over and over)

Created on Mar 27, 2015

@author: lukas, nobcat
'''

import json
import subprocess

colors = ['purple',
          'blue',
          'yellow',
          ]

defaultData = {"color":"purple",
               "effect":"night rider"
               }

def read_current():
    try:
        with open('/home/osmc/hyperion/current.json', 'r') as f:
            data = json.load(f)
        f.close()
        if data == '':
            return defaultData
        else:
            return data
    except (IOError, ValueError):
        return defaultData

def write_current(data):
    try:
        with open('/home/osmc/hyperion/current.json', 'w') as f:
            json.dump(data, f)
        f.close()
    except IOError:
        pass

def parse_current_effect():
    pass

def set_current_effect():
    pass

def set_color(color):
    subprocess.Popen('/opt/hyperion/bin/hyperion-remote --priority 100 --color ' + color, shell=True)

def main():
    current_data = read_current()
    for i,color in enumerate(colors):
        if color == current_data['color']:
            if i == len(colors) - 1:
                current_data['color'] = colors[0]
                break
            else:
                current_data['color'] = colors[i + 1]
                break

    write_current(current_data)
    set_color(current_data['color'])

main()

Last we define the buttons in remote.xml

<yellow>RunScript("/home/osmc/hyperion/colourswitch.py")</yellow>
<blue>RunScript("/home/osmc/hyperion/switch.py")</blue>
<red>RunScript("/home/osmc/hyperion/off.py")</red>

And put remote.xml on /home/osmc/.kodi/userdata/keymaps

 

 

 

 

Floppy

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.