neeo_driver_sony_bravia does not start

https://github.com/trouty00/neeo_driver_sony_bravia

After installing the driver and changing the settings I cant start the driver.

 

$ node index.js 

/home/nelus/node_modules/neeo_driver_sony_bravia/index.js:135

    brain:,

          ^

 

I have tried multiple settings in index.js

Reply
12replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular

  • Niels Feenstra  Hey, as far as I can see, all you have to do is delete the ":" then it should work.

    Like
    • Fäbu Thanks for your help!

      This is the error i get:

       

      $ sudo node index.js 

      /home/nelus/node_modules/neeo_driver_sony_bravia/index.js:136

          port: 6336,

                ^

      Like
      • Fäbu@NEEO
      • Driver Development Team
      • Fabu
      • 1 yr ago
      • Reported - view

      Niels Feenstra I'm sorry I misspelled and edited it, you have to delete ":" not ","

      Like
  • Like this:

      function startSdkExample(brain) {

      console.log('- Start server');

      neeoapi.startServer({

        brain ,

        port: 6336,

        name: 'simple-adapter-one',

        devices: [braviatv]

     

    It stil wont start

    Like
      • Fäbu@NEEO
      • Driver Development Team
      • Fabu
      • 1 yr ago
      • Reported - view

      Niels Feenstra i see there is some space after brain, i think you need to delete the space like brain,

      Like
  • Yeah tried that.

     

    I looks like it is going a little bit further:

     

    $ sudo node index.js 

    NEEO SDK Example "simpleCustomDevice" adapter

    ---------------------------------------------

    /home/nelus/node_modules/neeo_driver_sony_bravia/node_modules/neeo-sdk/lib/device/devicetype/index.js:17

      throw new Error('INVALID_DEVICETYPE');

      ^

     

    Error: INVALID_DEVICETYPE

    Like
      • Fäbu@NEEO
      • Driver Development Team
      • Fabu
      • 1 yr ago
      • 1
      • Reported - view

      Niels Feenstra This is a NEEO SDK error you need to update to a newer NEEO SDK, you can open package.json and search this lines:
       

        "bundleDependencies": false,
        "dependencies": {
          "neeo-sdk": "^0.48.13",
          "sony-bravia-tv-remote": "^2.0.0"

      change the version to this you see in my example, now you can execute again in the folder "npm update" or "npm install" then the driver should work.

      But i see another problem you need to edit.
      open index.js and on line 32 you find 'ENTER' you need to rename it to 'CURSOR ENTER'

      and last

      open controller.js
      on line 39 you find neeo:'ENTER' you need to rename it to 'CURSOR ENTER' but dont change bravia:'Enter'

      This community driver is very old :)

      Like 1
    • Fäbu Thank you! its working now!

      Like
    • Fäbu 

      I have tried all the steps, and still have the same issue. From which folder should I run npm update?

      pi@hassbian:~/node_modules $ node neeo_driver_sony_bravia/
      NEEO SDK Example "simpleCustomDevice" adapter
      ---------------------------------------------
      /home/pi/node_modules/neeo_driver_sony_bravia/node_modules/neeo-sdk/lib/device/devicetype/index.js:17
        throw new Error('INVALID_DEVICETYPE');
        ^
      
      Error: INVALID_DEVICETYPE
          at Object.module.exports.getDeviceType (/home/pi/node_modules/neeo_driver_sony_bravia/node_modules/neeo-sdk/lib/device/devicetype/index.js:17:9)
          at DeviceBuilder.setType (/home/pi/node_modules/neeo_driver_sony_bravia/node_modules/neeo-sdk/lib/device/devicebuilder.js:65:28)
          at Object.<anonymous> (/home/pi/node_modules/neeo_driver_sony_bravia/index.js:14:4)
          at Module._compile (internal/modules/cjs/loader.js:721:30)
          at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
          at Module.load (internal/modules/cjs/loader.js:620:32)
          at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
          at Function.Module._load (internal/modules/cjs/loader.js:552:3)
          at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)
          at executeUserCode (internal/bootstrap/node.js:342:17)
          at startExecution (internal/bootstrap/node.js:276:5)
          at startup (internal/bootstrap/node.js:227:5)
          at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
      Like
  • Fäbu (or anyone else that is able to assist please), 

    I appreciate this thread is quite old, but I would really appreciate some help please. 

    Using this driver: https://github.com/trouty00/neeo_driver_sony_bravia and following the instructions in the thread above, I've managed to get this driver working successfully for my Sony Bravia (KDL60W850B) except for one issue. The PowerOn command does not turn the TV on when the TV is in standby mode.

    I know this is because the TV can't receive IRCC-IP commands when it is in standby mode because it's HTTP server is not running. 

    According to https://pro-bravia.sony.net/develop/integrate/ip-control/ I need to send a WoL magic packet several times to enable IRCC-IP when the TV is in standby mode.

     

    Could you tell me what code I need to put and where - so that I can get this driver to send the WoL magic packet when the PowerOn button is pressed please?

    Thank you kindly for your time & assistance.

    Regards,
    Andrew

     

    Here is the code I'm using for this driver;

    package.json

    {
      "name": "neeo_driver_sony_bravia",
      "version": "0.0.4",
      "description": "This app brings NEEO and Sony Bravia Android TV's together",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "keywords": [
        "neeo",
        "bravia",
        "androidtv"
      ],
      "author": "Stuart Trout",
      "license": "ISC",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/trouty00/neeo_driver_sony_bravia.git"
      },
      "bugs": {
        "url": "https://github.com/trouty00/neeo_driver_sony_bravia/issues"
      },
      "homepage": "https://github.com/trouty00/neeo_driver_sony_bravia#readme",
      "dependencies": {
        "neeo-sdk": "^0.51.13",
        "sony-bravia-tv-remote": "^2.0.0"
      },
      "engines": {
        "node": ">=6.0.0"
      },
      "neeoSdkOptions": {
        "brainHost": "192.168.1.121"
      }
    }

    index.js

    'use strict';
    
    
    const neeoapi = require('neeo-sdk');
    const controller = require('./controller');
    
    console.log('NEEO SDK Example "simpleCustomDevice" adapter');
    console.log('---------------------------------------------');
    
    const braviatv = neeoapi.buildDevice('Bravia TV')
    
    .setManufacturer('Sony')
    .addAdditionalSearchToken('foo')
    .setType('TV')
    
    .addButton({ name: 'POWER ON', label: 'Power On' }, controller.button)
    .addButton({ name: 'POWER OFF', label: 'Power Off' }, controller.button)
    .addButton({ name: 'CURSOR LEFT', label: 'Left' }, controller.button)
    .addButton({ name: 'CURSOR RIGHT', label: 'Right' }, controller.button)
    .addButton({ name: 'CURSOR UP', label: 'Up'} , controller.button)
    .addButton({ name: 'CURSOR DOWN', label: 'Down' }, controller.button)
    .addButton({ name: 'INPUT HDMI 1', label: 'HDMI 1' }, controller.button)
    .addButton({ name: 'INPUT HDMI 2', label: 'HDMI 2' }, controller.button)
    .addButton({ name: 'INPUT HDMI 3', label: 'HDMI 3' }, controller.button)
    .addButton({ name: 'INPUT HDMI 4', label: 'HDMI 4' }, controller.button)
    .addButton({ name: 'HOME', label: 'Home' }, controller.button)
    .addButton({ name: 'MUTE TOGGLE', label: 'Mute' }, controller.button)
    .addButton({ name: 'VOLUME UP', label: 'Volume Up' }, controller.button)
    .addButton({ name: 'VOLUME DOWN', label: 'Volume Down' }, controller.button)
    .addButton({ name: 'BACK', label: 'Back' }, controller.button)
    .addButton({ name: 'STOP', label: 'Stop' }, controller.button)
    .addButton({ name: 'CURSOR ENTER', label: 'Enter' }, controller.button)
    .addButton({ name: 'PLAY', label: 'Play' }, controller.button)
    .addButton({ name: 'PAUSE', label: 'Pause' }, controller.button)
    .addButton({ name: 'RECORD', label: 'Rec' }, controller.button)
    .addButton({ name: 'SKIP BACKWARD', label: 'Skip Backward' }, controller.button)
    .addButton({ name: 'SKIP FORWARD', label: 'Skip Forward' }, controller.button)
    .addButton({ name: 'FORWARD', label: 'Forward' }, controller.button)
    .addButton({ name: 'REVERSE', label: 'Reverse' }, controller.button)
    //.addButton({ name: 'PREVIOUS', label: 'Previous' }, controller.button)
    .addButton({ name: 'MENU', label: 'Menu' }, controller.button)
    .addButton({ name: 'CHANNEL UP', label: 'Channel Up' }, controller.button)
    .addButton({ name: 'CHANNEL DOWN', label: 'Channel Down' }, controller.button)
    .addButton({ name: 'FUNCTION RED', label: 'Red' }, controller.button)
    .addButton({ name: 'FUNCTION GREEN', label: 'Green' }, controller.button)
    .addButton({ name: 'FUNCTION YELLOW', label: 'Yellow' }, controller.button)
    .addButton({ name: 'FUNCTION BLUE', label: 'Blue' }, controller.button)
    .addButton({ name: 'DIGIT 0', label: '0' }, controller.button)
    .addButton({ name: 'DIGIT 1', label: '2' }, controller.button)
    .addButton({ name: 'DIGIT 2', label: '3' }, controller.button)
    .addButton({ name: 'DIGIT 3', label: '4' }, controller.button)
    .addButton({ name: 'DIGIT 4', label: '5' }, controller.button)
    .addButton({ name: 'DIGIT 5', label: '5' }, controller.button)
    .addButton({ name: 'DIGIT 6', label: '6' }, controller.button)
    .addButton({ name: 'DIGIT 7', label: '7' }, controller.button)
    .addButton({ name: 'DIGIT 8', label: '8' }, controller.button)
    .addButton({ name: 'DIGIT 9', label: '9' }, controller.button)
    .addButton({ name: 'INPUT TV', label: 'TV' }, controller.button)
    .addButton({ name: 'RADIO', label: 'RADIO' }, controller.button)
    .addButton({ name: 'GUIDE', label: 'Guide' }, controller.button)
    .addButton({ name: 'INPUT', label: 'Input' }, controller.button)
    .addButton({ name: 'NETFLIX', label: 'Netflix' }, controller.button)
    .addButtonHander(controller.braviaButtonPressed);
    
    function startSdkExample(brain) {
    console.log('- Start server');
    neeoapi.startServer({
    brain,
    port: 6336,
    name: 'simple-adapter-one',
    
    devices: [braviatv]
    
    //if you have more than one device they are defined as per below
    //devices: [braviatv, braviatv2]
    
    })
    .then(() => {
    console.log('# READY! use the NEEO app to search for "Sony Bravia".');
    })
    
    .catch((error) => {
    //if there was any error, print message out to console
    console.error('ERROR!', error.message);
    process.exit(1);
    });
    
    }
    
    const brainIp = process.env.BRAINIP;
    if (brainIp) {
    console.log('- use NEEO Brain IP from env variable', brainIp);
    startSdkExample(brainIp);
    
    } else {
    console.log('- discover one NEEO Brain...');
    neeoapi.discoverOneBrain()
    .then((brain) => {
    console.log('- Brain discovered:', brain.name);
    startSdkExample(brain);
    });
    }

     

    controller.js

    //TV PLUGIN
    'use strict';
    
    /*
    * Device Controller
    * Events on that device from the Brain will be forwarded here for handling.
    * NOTE: there are no multiple devices support for this example, so only the button name is passed
    */
    
    // As ES6 Import
    // import BraviaRemoteControl from 'sony-bravia-tv-remote';
    // Connect to a local sony tv at 192.168.1.118:80 with the auth key of 1111
    
    const BraviaRemoteControl = require('sony-bravia-tv-remote');
    const braviaIP = '192.168.1.118';
    const braviaPort = 80;
    const braviaCode = '1111';
    const remote = new BraviaRemoteControl(braviaIP, braviaPort, braviaCode);
    
    function tvbuttonMappings() {
    return [
    {neeo: 'POWER OFF', bravia: 'PowerOff'},
    {neeo: 'CURSOR LEFT', bravia: 'Left'},
    {neeo: 'POWER ON', bravia: 'PowerOn'},
    {neeo: 'CURSOR RIGHT', bravia: 'Right'},
    {neeo: 'CURSOR DOWN', bravia: 'Down'},
    {neeo: 'CURSOR UP', bravia: 'Up'},
    {neeo: 'INPUT HDMI 1', bravia: 'Hdmi1'},
    {neeo: 'INPUT HDMI 2', bravia: 'Hdmi2'},
    {neeo: 'INPUT HDMI 3', bravia: 'Hdmi3'},
    {neeo: 'INPUT HDMI 4', bravia: 'Hdmi4'},
    {neeo: 'HOME', bravia: 'Home'},
    {neeo: 'MUTE TOGGLE', bravia: 'Mute'},
    {neeo: 'VOLUME UP', bravia: 'VolumeUp'},
    {neeo: 'VOLUME DOWN', bravia: 'VolumeDown'},
    {neeo: 'BACK', bravia: 'Return'},
    {neeo: 'STOP', bravia: 'Stop'},
    {neeo: 'CURSOR ENTER', bravia: 'Enter'},
    {neeo: 'PLAY', bravia: 'Play'},
    {neeo: 'PAUSE', bravia: 'Pause'},
    {neeo: 'RECORD', bravia: 'Rec'},
    {neeo: 'SKIP BACKWARD', bravia: 'Previous'},
    {neeo: 'SKIP FORWARD', bravia: 'Next'},
    {neeo: 'FORWARD', bravia: 'Forward'},
    {neeo: 'REVERSE', bravia: 'Rewind'},
    {neeo: 'MENU', bravia: 'Home'},
    {neeo: 'CHANNEL UP', bravia: 'ChannelUp'},
    {neeo: 'CHANNEL DOWN', bravia: 'ChannelDown'},
    {neeo: 'FUNCTION RED', bravia: 'Red'},
    {neeo: 'FUNCTION GREEN', bravia: 'Green'},
    {neeo: 'FUNCTION YELLOW', bravia: 'Yellow'},
    {neeo: 'CHANNEL BLUE', bravia: 'Blue'},
    {neeo: 'INPUT TV', bravia: 'Tv'},
    {neeo: 'DIGIT 1', bravia: 'Num1'},
    {neeo: 'DIGIT 2', bravia: 'Num2'},
    {neeo: 'DIGIT 3', bravia: 'Num3'},
    {neeo: 'DIGIT 4', bravia: 'Num4'},
    {neeo: 'DIGIT 5', bravia: 'Num5'},
    {neeo: 'DIGIT 6', bravia: 'Num6'},
    {neeo: 'DIGIT 7', bravia: 'Num7'},
    {neeo: 'DIGIT 8', bravia: 'Num8'},
    {neeo: 'DIGIT 9', bravia: 'Num9'},
    {neeo: 'DIGIT 0', bravia: 'Num0'},
    {neeo: 'INPUT TV', bravia: 'Tv'},
    {neeo: 'RADIO', bravia: 'Tv_Radio'},
    {neeo: 'GUIDE', bravia: 'GGuide'},
    {neeo: 'INPUT', bravia: 'Input'},
    {neeo: 'NETFLIX', bravia: 'Netflix'},
    // Add the rest.
    ];
    }
    
    module.exports.braviaButtonPressed = function braviaButtonPressed(name, deviceid) {
    const keyMap = tvbuttonMappings().find((key) => key.neeo === name);
    remote.sendAction(keyMap.bravia);
    console.log('Key, NEEO:'+keyMap.neeo+' Bravia:'+keyMap.bravia);
    }
    Like
    • With the help of a very kind soul, I have this now working.  I'll post the solution here once I've finished writing this up.  

      Like
  • Instructions attached for getting IP Control to work with my Sony Bravia (KDL60W850B) and adding WOL capability to the driver so that the PowerOn command will actually turn on the TV from standby.

    NB: Updated instructions with a final step that includes running the driver from within a Docker container.

    Like 1
Like Follow