1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED On/Off Solution - LEDs light up with Chromecast background image when TV is off

Discussion in 'Software Support' started by alieg, 20 January 2020.

  1. alieg

    alieg New Member

    Messages:
    8
    Hardware:
    RPi3
    I've got my setup installed and working, with a few issues left to address

    My problem right now is that when I turn the TV off the video grabber is still receiving a signal from the Chromecast and the LEDs display whatever it has as the background image.

    I followed the No Soldering Tutorial amogst other sources around the web so my basic setup is largely the same

    Multiple sources (Chromecast, Laptop, Nintendo Switch, PS4) into an automatic HDMI Switch ->
    Powered HDMI splitter ->
    TV and Powered HDMI to RCA converter ->
    Raspberry Pi 3 ->
    WS2801 LED strip connected to the Pi on GPIO pins for Ground, Data and Clock/Signal, 5v and Ground connected to a 5v power supply.

    I have explored the idea of powering a component with the TV USB port but have encountered a few issues/thoughts:
    Chromecast - I like using the cast button and having the TV turn on with HDMI-CEC, this will not work if it is powered by the TV USB port
    Raspberry Pi - I don't want to just kill the power to the Pi
    HDMI Splitter - The lights stay on in their last state, they just go dimmer and surely this would kill the HDMI-CEC turn on signal also
    HDMI to RCA - The lights stay on in their last state, they just go dimmer


    I was also exploring the idea of mapping the TV remote power button to a script which would turn on/off Hyperion, however it now occurs to me that it may not work because I'm not using the Pi as an input at all; I don't have it plugged into one of the TV's HDMI and I never intend to use it as a media source (I have confirmed the remote does partially work when I was setting up OpenElec).

    Currently I am just pulling the power supply to the LEDs when not in use but I would like it to turn on and off automatically.

    • If I did plug in the Pi to the TV with an HDMI cable and it was not on that AV Input would it still receive the signal from the power button and run the script to stop/start Hyperion?
    • Is there anything in the HyperCon settings I can do to achieve the desired behaviour of turning the LEDs off with the TV?
    • As a slight improvement to my current solution would I be able to use some sort of USB switch between the grabber and the Pi (Such as Example 1 or Example 2) or a DC switch between the LEDs and power supply
    • Is there any other solution that I may be able to use?
    I'm aware that this is not neccessarily a sowtware issue but I'd prefferably like to come to a software solution.

    I can upload the hyperion config file later if needed as I don't I have access to it right now.
     
  2. Paulchen-Panther

    Paulchen-Panther Active Member Developer

    Messages:
    476
    Hardware:
    RPi1/Zero, RPi3, 32/64bit, +Arduino
    Is your TV connected to your home network? If so, could you try to ping your TV? Are there two different results when the device is switched off or switched on?
     
  3. alieg

    alieg New Member

    Messages:
    8
    Hardware:
    RPi3
    No, the TV is pre-smart TV so isn't connected to the network at all by itself, the Chromecast is a Gen 2 model plugged into an HDMI port on the switch and is what we consume most of our media on which is why it is the default AV input.

    The TV is also an LG which I've been reading doesn't play so nice with HDMI-CEC - it will turn on the TV but wouldn't switch the AV automatically and doesn't implement deck controls. I would assume it doesn't send a message to tell other devices "Hey, I'm turning off now" either


    This is my config file:

    Code:
    // Automatically generated configuration file for Hyperion ambilight daemon
    // Notice: All values are explained with comments at our wiki: wiki.hyperion-project.org (config area)
    // Generated by: HyperCon (The Hyperion deamon configuration file builder)
    // Created with HyperCon V1.03.3 (22.10.2017)
    
    {
        // DEVICE CONFIGURATION
        "device" :
        {
            "name"       : "MyHyperionConfig",
            "type"       : "ws2801",
            "output"     : "/dev/spidev1.0",
            "rate"     : 1000000,
            "colorOrder" : "rgb"
        },
    
        // COLOR CALIBRATION CONFIG
        "color" :
        {
            "channelAdjustment" :
            [
                {
                    "id"   : "default",
                    "leds" : "*",
                    "pureRed" :
                    {
                        "redChannel"        : 255,
                        "greenChannel"        : 0,
                        "blueChannel"        : 0
                    },
                    "pureGreen" :
                    {
                        "redChannel"        : 50,
                        "greenChannel"        : 210,
                        "blueChannel"        : 0
                    },
                    "pureBlue" :
                    {
                        "redChannel"        : 0,
                        "greenChannel"        : 0,
                        "blueChannel"        : 135
                    }
                }
            ],
            "temperature" :
            [
                {
                    "id"   : "default",
                    "leds" : "*",
                    "correctionValues" :
                    {
                        "red"     : 255,
                        "green"    : 255,
                        "blue"     : 255
                    }
                }
            ],
            "transform" :
            [
                {
                    "id"   : "default",
                    "leds" : "*",
                    "hsl" :
                    {
                        "saturationGain"    : 0.6000,
                        "luminanceGain"        : 1.2000,
                        "luminanceMinimum"        : 0.2000
                    },
                    "red" :
                    {
                        "threshold"     : 0.0000,
                        "gamma"         : 2.5000
                    },
                    "green" :
                    {
                        "threshold"     : 0.0000,
                        "gamma"         : 2.5000
                    },
                    "blue" :
                    {
                        "threshold"     : 0.0000,
                        "gamma"         : 2.5000
                    }
                }
            ],
        // SMOOTHING CONFIG
            "smoothing" :
            {
                "type"            : "linear",
                "time_ms"         : 100,
                "updateFrequency" : 50.0000,
                "updateDelay"     : 0
            }
        },
    
        // V4L2 GRABBER CONFIG
        "grabber-v4l2" :
        {
            "device" : "/dev/video0",
            "input" : 0,
            "standard" : "PAL",
            "width" : -1,
            "height" : -1,
            "frameDecimation" : 2,
            "sizeDecimation" : 8,
            "priority" : 900,
            "mode" : "2D",
            "cropLeft" : 30,
            "cropRight" : 30,
            "cropTop" : 30,
            "cropBottom" : 30,
            "redSignalThreshold" : 0.0,
            "greenSignalThreshold" : 0.0,
            "blueSignalThreshold" : 0.0
        },
    
        // BLACKBORDER CONFIG
        "blackborderdetector" :
        {
            "enable" : true,
            "threshold" : 0.1,
            "unknownFrameCnt" : 600,
            "borderFrameCnt" : 50,
            "maxInconsistentCnt" : 10,
            "blurRemoveCnt" : 1,
            "mode" : "default"
        },
    
        // JSON SERVER CONFIG
        "jsonServer" :
        {
            "port" : 19444
        },
    
        // PROTO SERVER CONFIG
        "protoServer" :
        {
            "port" : 19445
        },
    
        // EFFECT PATH
        "effects" :
        {
            "paths" :
            [
                "/storage/hyperion/effects",
                "/usr/share/hyperion/effects"
            ]
        },
    
        // NO FRAME GRABBER CONFIG
        // NO KODI CHECK CONFIG
        // NO BOOTEFFECT CONFIG
        // NO BOBLIGHT SERVER CONFIG
        // NO JSON/PROTO FORWARD CONFIG
    
        // LED CONFIGURATION
        "leds" :
        [
            {
                "index" : 0,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.9524, "maximum" : 1.0000 }
            },
            {
                "index" : 1,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.9048, "maximum" : 0.9524 }
            },
            {
                "index" : 2,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.8571, "maximum" : 0.9048 }
            },
            {
                "index" : 3,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.8095, "maximum" : 0.8571 }
            },
            {
                "index" : 4,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.7619, "maximum" : 0.8095 }
            },
            {
                "index" : 5,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.7143, "maximum" : 0.7619 }
            },
            {
                "index" : 6,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.6667, "maximum" : 0.7143 }
            },
            {
                "index" : 7,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.6190, "maximum" : 0.6667 }
            },
            {
                "index" : 8,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.5714, "maximum" : 0.6190 }
            },
            {
                "index" : 9,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.5238, "maximum" : 0.5714 }
            },
            {
                "index" : 10,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.4762, "maximum" : 0.5238 }
            },
            {
                "index" : 11,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.4286, "maximum" : 0.4762 }
            },
            {
                "index" : 12,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.3810, "maximum" : 0.4286 }
            },
            {
                "index" : 13,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.3333, "maximum" : 0.3810 }
            },
            {
                "index" : 14,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.2857, "maximum" : 0.3333 }
            },
            {
                "index" : 15,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.2381, "maximum" : 0.2857 }
            },
            {
                "index" : 16,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.1905, "maximum" : 0.2381 }
            },
            {
                "index" : 17,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.1429, "maximum" : 0.1905 }
            },
            {
                "index" : 18,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.0952, "maximum" : 0.1429 }
            },
            {
                "index" : 19,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.0476, "maximum" : 0.0952 }
            },
            {
                "index" : 20,
                "hscan" : { "minimum" : 0.9500, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0476 }
            },
            {
                "index" : 21,
                "hscan" : { "minimum" : 0.9706, "maximum" : 1.0000 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 22,
                "hscan" : { "minimum" : 0.9412, "maximum" : 0.9706 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 23,
                "hscan" : { "minimum" : 0.9118, "maximum" : 0.9412 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 24,
                "hscan" : { "minimum" : 0.8824, "maximum" : 0.9118 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 25,
                "hscan" : { "minimum" : 0.8529, "maximum" : 0.8824 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 26,
                "hscan" : { "minimum" : 0.8235, "maximum" : 0.8529 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 27,
                "hscan" : { "minimum" : 0.7941, "maximum" : 0.8235 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 28,
                "hscan" : { "minimum" : 0.7647, "maximum" : 0.7941 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 29,
                "hscan" : { "minimum" : 0.7353, "maximum" : 0.7647 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 30,
                "hscan" : { "minimum" : 0.7059, "maximum" : 0.7353 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 31,
                "hscan" : { "minimum" : 0.6765, "maximum" : 0.7059 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 32,
                "hscan" : { "minimum" : 0.6471, "maximum" : 0.6765 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 33,
                "hscan" : { "minimum" : 0.6176, "maximum" : 0.6471 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 34,
                "hscan" : { "minimum" : 0.5882, "maximum" : 0.6176 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 35,
                "hscan" : { "minimum" : 0.5588, "maximum" : 0.5882 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 36,
                "hscan" : { "minimum" : 0.5294, "maximum" : 0.5588 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 37,
                "hscan" : { "minimum" : 0.5000, "maximum" : 0.5294 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 38,
                "hscan" : { "minimum" : 0.4706, "maximum" : 0.5000 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 39,
                "hscan" : { "minimum" : 0.4412, "maximum" : 0.4706 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 40,
                "hscan" : { "minimum" : 0.4118, "maximum" : 0.4412 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 41,
                "hscan" : { "minimum" : 0.3824, "maximum" : 0.4118 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 42,
                "hscan" : { "minimum" : 0.3529, "maximum" : 0.3824 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 43,
                "hscan" : { "minimum" : 0.3235, "maximum" : 0.3529 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 44,
                "hscan" : { "minimum" : 0.2941, "maximum" : 0.3235 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 45,
                "hscan" : { "minimum" : 0.2647, "maximum" : 0.2941 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 46,
                "hscan" : { "minimum" : 0.2353, "maximum" : 0.2647 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 47,
                "hscan" : { "minimum" : 0.2059, "maximum" : 0.2353 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 48,
                "hscan" : { "minimum" : 0.1765, "maximum" : 0.2059 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 49,
                "hscan" : { "minimum" : 0.1471, "maximum" : 0.1765 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 50,
                "hscan" : { "minimum" : 0.1176, "maximum" : 0.1471 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 51,
                "hscan" : { "minimum" : 0.0882, "maximum" : 0.1176 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 52,
                "hscan" : { "minimum" : 0.0588, "maximum" : 0.0882 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 53,
                "hscan" : { "minimum" : 0.0294, "maximum" : 0.0588 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 54,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0294 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0800 }
            },
            {
                "index" : 55,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.0000, "maximum" : 0.0476 }
            },
            {
                "index" : 56,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.0476, "maximum" : 0.0952 }
            },
            {
                "index" : 57,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.0952, "maximum" : 0.1429 }
            },
            {
                "index" : 58,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.1429, "maximum" : 0.1905 }
            },
            {
                "index" : 59,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.1905, "maximum" : 0.2381 }
            },
            {
                "index" : 60,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.2381, "maximum" : 0.2857 }
            },
            {
                "index" : 61,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.2857, "maximum" : 0.3333 }
            },
            {
                "index" : 62,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.3333, "maximum" : 0.3810 }
            },
            {
                "index" : 63,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.3810, "maximum" : 0.4286 }
            },
            {
                "index" : 64,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.4286, "maximum" : 0.4762 }
            },
            {
                "index" : 65,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.4762, "maximum" : 0.5238 }
            },
            {
                "index" : 66,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.5238, "maximum" : 0.5714 }
            },
            {
                "index" : 67,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.5714, "maximum" : 0.6190 }
            },
            {
                "index" : 68,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.6190, "maximum" : 0.6667 }
            },
            {
                "index" : 69,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.6667, "maximum" : 0.7143 }
            },
            {
                "index" : 70,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.7143, "maximum" : 0.7619 }
            },
            {
                "index" : 71,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.7619, "maximum" : 0.8095 }
            },
            {
                "index" : 72,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.8095, "maximum" : 0.8571 }
            },
            {
                "index" : 73,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.8571, "maximum" : 0.9048 }
            },
            {
                "index" : 74,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.9048, "maximum" : 0.9524 }
            },
            {
                "index" : 75,
                "hscan" : { "minimum" : 0.0000, "maximum" : 0.0500 },
                "vscan" : { "minimum" : 0.9524, "maximum" : 1.0000 }
            }
        ],
    
        "endOfJson" : "endOfJson"
    }
    
     
  4. Paulchen-Panther

    Paulchen-Panther Active Member Developer

    Messages:
    476
    Hardware:
    RPi1/Zero, RPi3, 32/64bit, +Arduino
    Then the software solution will definitely be eliminated without additional hardware. Hyperion cannot use this feature (on / off state TV) OOTB.
    Sorry
     
  5. alieg

    alieg New Member

    Messages:
    8
    Hardware:
    RPi3
    If I connected a USB IR receiver to the Pi would that be a potential solution to run the script when the power button is pressed on the remote?
    Or is there a way I could trigger the script from my phone? I have a couple of sets of IFTTT buttons, perhaps there's something I could do with Webhooks??
     
  6. alieg

    alieg New Member

    Messages:
    8
    Hardware:
    RPi3
    I have found a partial solution to this issue by getting an on/off script to work as a button on my phone:

    Firstly I was having some issues with the script in the tutorial link so I altered it to use the same commands as the start and stop buttons in HyperCon.

    I used an app RaspController to send this as a custom command to the Pi,

    Code:
    #!/bin/sh
    SERVICE='hyperiond'
    if ps | grep -v grep | grep $SERVICE > /dev/null
    then
    killall hyperiond 2>/dev/null
    else
    /storage/.config/autostart.sh > /dev/null 2>&1 &
    fi
    I got an error when trying to use the code the tutorial suggests adding to the keymap to execute the command from the hyperionswitch.sh file

    Code:
    system.exec("/storage/.kodi/userdata/hyperionswitch.sh")
    sh: syntax error: unexpected word (expecting ")")

    If I can figure this out I'm fairly confident that I could run it from a button press on the remote if I could find a suitable IR Receiver.

    The problem with using RaspController on its own is that it launches the ssh window from the custom command and from the widget (which also looks a little ugly to me and doesn't match in with my IFTTT button widgets) and requires another button press to exit out afterwards.

    I used the app Tasker to create a different style widget shortcut which runs the command from RaspController with nothing other than just a toast notification. I gave it an icon from a downloaded Raspberry Pi logo to match another Tasker shortcut on my home screen.
     

    Attached Files:

    Last edited: 27 January 2020
    • Like Like x 2