
Home Assistant Integration
I've started working on a Home Assistant ( https://home-assistant.io/ ) integration to allow the control of devices in Home Assistant from NEEO. I've only just started working on it (got my NEEO yesterday) so the functionality is very limited at the moment, only lights/switches/scenes can be controlled.
Use It
You can find it here: https://github.com/jakeblatchford/neeo-homeassistant
There are instructions in the repository and auto-discovery should make the setup of devices quite easy once you have configured the integration.
I'll be adding support for more device types and fixing the issues listed on the project readme. I'd be grateful if anyone can spot any obvious solutions to the problems noted, I've not written any NodeJS for about 5 years so I'm a bit rusty. Pull requests are welcome.
Why?
If you're interested in why I'm working on this read on. I've ended up using Home Assistant to tie together a wide range of different home automation products. Over the last few years I've built up my home automation and tried lots of different products, as a result I now have Philips Hue, IKEA Tradfri and LIFX smart bulbs, a wide range of Zigbee and Z-Wave sensors/sockets, Z-Wave USB controller, SmartThings Hub, Hue Hub, Tradfri Hub, Amazon Alexa, Google Home and a number of DIY devices using MQTT.
Home Assistant has allowed me to centralise control of all these devices into one place, and most of my setup is controllable by voice using Google Home and Alexa via Home Assistant. This project aims to allow control of the exhaustive list of Home Assistant supported devices from NEEO without having to add all the devices directly to NEEO.
Jake
-
Thanks. I couldn't get the version I downloaded yesterday to work anymore, so trashed it, downloaded again (same version I think) and now works.
So first I tested a 'regular' smart switch I have in Home Assistant. I created a recipe in NEEO with a POWER_TOGGLE and this works fine. Tap the button and it turns the switch on, tap again and it switches it off.
I created a couple more recipes in NEEO, one that did POWER ON for the same switch, and another recipe that did POWER OFF for that switch. Neither of these would work. The log appears to be exactly the same for both these, so here's one version
ReferenceError: setBrightnessState is not defined at module.exports.onButtonPressed (/home/pi/node_modules/neeo-homeassistant/controller.js:57:7) at Object.module.exports.trigger (/home/pi/node_modules/neeo-homeassistant/node_modules/neeo-sdk/lib/device/handler/button.js:6:30) at checkForFunction.then (/home/pi/node_modules/neeo-homeassistant/node_modules/neeo-sdk/lib/device/handler/RequestHandler.js:57:27) at tryCatcher (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromiseCtx (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/promise.js:606:10) at Async._drainQueue (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/async.js:138:12) at Async._drainQueues (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/async.js:143:10) at Immediate.Async.drainQueues (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:789:20) at tryOnImmediate (timers.js:751:5) at processImmediate [as _immediateCallback] (timers.js:722:5)
Then I have some 'non regular' switches setup in Home Assistant, ones that run different scenes depending on whether they're switched on or off. Here's an example
switch: living_room_lights: value_template: "{{ is_state('living_room_lights', 'on') }}" turn_on: - service: scene.turn_on entity_id: scene.living_room_lights_on turn_off: - service: scene.turn_on entity_id: scene.living_room_lights_off
Again I created a POWER_TOGGLE recipe in NEEO. This worked at turning on the switch (activating 'scene.living_room_lights_on' in Home Assistant), but pressing again didn't turn off the switch (activate 'scene.living_room_lights_off').
The log for toggling both times appears exactly the same (even though turning the switch on worked and turning the switch off didn't)
calling service switch on entity switch.lounge_lights with action toggle Using options { method: 'POST', uri: 'https://MY_URL.duckdns.org/api/services/switch/toggle', body: { entity_id: 'switch.lounge_lights' }, json: true, headers: { 'x-ha-access': 'HA_PASSWORD' } } service call successful
I also created POWER ON and POWER OFF recipes for the same switch I have in Home Assistant and neither of these would work. Here's the log for those (both the same)
ReferenceError: setBrightnessState is not defined at module.exports.onButtonPressed (/home/pi/node_modules/neeo-homeassistant/controller.js:54:7) at Object.module.exports.trigger (/home/pi/node_modules/neeo-homeassistant/node_modules/neeo-sdk/lib/device/handler/button.js:6:30) at checkForFunction.then (/home/pi/node_modules/neeo-homeassistant/node_modules/neeo-sdk/lib/device/handler/RequestHandler.js:57:27) at tryCatcher (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromiseCtx (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/promise.js:606:10) at Async._drainQueue (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/async.js:138:12) at Async._drainQueues (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/async.js:143:10) at Immediate.Async.drainQueues (/home/pi/node_modules/neeo-homeassistant/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:789:20) at tryOnImmediate (timers.js:751:5) at processImmediate [as _immediateCallback] (timers.js:722:5)
-
…BTW, maybe you should add this to this page and this document.
-
Jake Blatchford
I tried to install to install your Home Assistant integration of Neeo and I'm getting the following error:
(hass_venv) hass@kpi:~/.homeassistant/neeo-homeassistant$ node index.js
/home/hass/.homeassistant/neeo-homeassistant/node_modules/neeo-sdk/lib/device/brain/urlbuilder.js:6
module.exports.buildBrainUrl = function(brain, baseUrl, brainport = DEFAULT_BRAIN_PORT) {
^SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/hass/.homeassistant/neeo-homeassistant/node_modules/neeo-sdk/lib/recipe/index.js:7:20)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/hass/.homeassistant/neeo-homeassistant/node_modules/neeo-sdk/lib/index.js:4:17)
at Module._compile (module.js:409:26)
(hass_venv) hass@kpi:~/.homeassistant/neeo-homeassistant$ hass --version
0.54.0I don't know javascript so I have no idea what this means. I installed the repo in my home assistant directory and ran "npm install" as the hass user with no errors. I setup the .env file with my password and URL to HA. I do use https on a non-standard port for HA so I'm not sure if that is part of the problem.
Any assistance would be greatly appreciated.
Galen Krokum
-
I have a problem with this 😐
It stopped working (error message: 'ERROR! ENV is not setup, no HA_URL'), so I trashed everything and then reinstalled from scratch. After reinstalling it worked fine…
until I rebooted the RPi running it. At first it appeared fine:
- discover one NEEO Brain... - Brain discovered: NEEO Lounge - Start server # READY! use the NEEO app to search for "Home Assistant".
But after sending a command through NEEO to Home Assistant it stopped in Terminal with the same error message as before:
ERROR! ENV is not setup, no HA_URL
I checked the .env file and haven't changed anything since it was working previously (same HA_URL as before). Any idea how to fix this?
-
hey folks, just getting round to installing this - got 2 questions:
1. not overly familiar with terminal, can someone help with installation (i mean i've managed to set up an advance HA set up, just not comfortable with the underlying OS)
2. What is your best practice for exposing devices to NEEO - do you surface everything, or, do you create a bunch of scripts/scenes and just expose those to NEEO (seems a common challenge with exposing to top tier interfaces (floorplan, alexa etc)
-
Thanks guys. I've tried a few variations using the static IP address of my pi (http://192.168.0.30:8123, http://192.168.0.30 , https://192.168.0.30:8123 , https://192.168.0.30 etc.).
It wouldn't authenticate when just using the http URLs, and when trying the https URLs it gave errors saying that the SSL certificate (through Let's Encrypt) wasn't valid for that address (presumably as it's only valid for my DuckDNS URL).
So I trashed everything and started again. I installed Node.js 8 (was previously using 6), the NEEO SDK and neeo-homeassistant from scratch. And now managed to get it working with my DuckDNS URL, and no problems/crashes after restarting the pi.
Maybe it didn't like the older version of Node.js I was using, and hopefully updating the NEEO SDK has helped. Anyway, I'm keeping my fingers crossed 🙂
Out of interest how is everyone auto-starting neeo-homeassistant after Raspberry Pi reboots?Edit:
Spoke too soon. Just rebooted the pi and getting the same error with neeo-homeassistant as before 😐 -
Hello Jake Blatchford , do you have plans for exposing Neeo events to HA, like what's available from the openHAB integration?