NEEO Remote Binding/Transport

@Nic_P
Yes - I depend on OH2.2 items now - so 2.1 won’t work. As for your error - you are using the latest and greatest binding right (the one I posted yesterday)? Pretty sure I fixed that error at some point but let me know if you are using the latest.

Just to let everyone know - I’m doing the merge process now. I have a few more bug fixes that I’ll release shortly (all involving the IO) and I think I’ve made the MDNS discovery process work well now (again, you’ll need to wait to the next bug fix)

Modified the very first post to include a new video that I posted that shows multi-brain recipes

Hi Tim,

The version I’m using was posted 2 days ago here:

https://github.com/openhab/openhab2-addons/files/1536194/org.openhab.binding.neeo-2.2.0-SNAPSHOT.zip

Is there a newer one since then? I cant seem to find it if there is

@tmrobert8 Finally found the time to do some testing. What a great job you have done! I have not stress tested it yet, but here are my first findings.

The transport nicely discovered and allowed me to expose all my openHAB lights to NEEO. Great job there. I do notice some issues with lables on the NEEO side, but that may not be because of the transport. For normal light switches, the label on the NEEO is a concatenation of the name given on the NEEO and the name as in the transport. For dimmers, where it shows a slider on the NEEO, the name is just the name given on the NEEO side.

I then went on experimenting with using the NEEO as a zwave controller. I installed my Christmas lights outside and connected it to a Zwave plug. I then went on trying to control this from openHAB, using the binding. This turned out to be a more elaborate exercise than expected.
The Zwave plug is exposed in NEEO as a switch. However, in the binding, I only have 2 macros (to turn on and off) and the overall Brain trigger channel to control it. This forced me to define quite a few roles if I wanted to just have an on/off switch on a sitemap. I may have missed a simpler way to do this, just keen to get your suggestions. Here is the result of my effort:

  • defined item: Kerst
  • defined 2 items linked to the 2 macro channels: KerstNEEOD487672e_Macros_TurnOn and KerstNEEOD487672e_Macros_TurnOff
  • rules file:
rule "NEEO"
    when
        Channel 'neeo:brain:d487672e:forwardActions' triggered
    then
        var data = receivedEvent.getEvent()
        var String action = transform("JSONPATH", "$.action", data);
        var String device = transform("JSONPATH", "$.device", data);
        var String room = transform("JSONPATH", "$.room", data);
        var String actionparameter = transform("JSONPATH", "$.actionparameter", data);

        if ((device == "Kerst") && (room == "Buiten")) {
            if (action == "BINARYSWITCH On/Off") {
                if (actionparameter == "true") {
                    Kerst.postUpdate(ON)
                } else if (actionparameter == "false") {
                    Kerst.postUpdate(OFF)
                }
            } else if (action == "turnOn") {
                Kerst.postUpdate(ON)
            } else if (action == "turnOff") {
                Kerst.postUpdate(OFF)
            }
        }
end

rule "Kerstverlichting aan"
when
    Item Kerst received command ON
then
    KerstNEEOD487672e_Macros_TurnOn.send(ON)
end

rule "Kerstverlichting uit"
when
    Item Kerst received command OFF
then
    KerstNEEOD487672e_Macros_TurnOff.send(ON)
end

rule "reset macro kerst on"
when
    Item KerstNEEOD487672e_Macros_TurnOn received command ON
then
    // because this is a switch for openHAB, but representing a button, turn it back off
    Thread::sleep(200)
    KerstNEEOD487672e_Macros_TurnOn.postUpdate(OFF)
end

rule "reset macro kerst off"
when
    Item KerstNEEOD487672e_Macros_TurnOff received command ON
then
    // because this is a switch for openHAB, but representing a button, turn it back off
    Thread::sleep(200)
    KerstNEEOD487672e_Macros_TurnOff.postUpdate(OFF)
end
  • sitemap file:
sitemap test label="Test"
{
	Frame {
		Switch item=Kerst
		Switch item=KerstNEEOD487672e_Macros_TurnOn mappings=[ON="ON"]
		Switch item=KerstNEEOD487672e_Macros_TurnOff mappings=[ON="OFF"]
	}
}

The last 2 lines in the sitemap just work as push buttons.
It looks like everything is in sync this way.
I think the fundamental problem is that I cannot easily get and set the state of the NEEO light in openHAB. The risk with my rules is that it will be out of sync if I restart openHAB, as I do not set the state of the light at startup.
I also think it might be worthwhile to turn of the macro switch in the binding (do a postUpdate), as these are really buttons and not switches. This would avoid a few lines of code above.
As the light is represented as a switch on the NEEO, is there no way to control that switch directly, rather than the on and off macros?
Interested in your view on this.

I am fine leaving the functionality as is right now and focus on debugging. I am willing to contribute towards a next version, but I do think the first focus should be to get the current binding merged.

@tmrobert8 Here is an exception I saw when testing:

2017-12-09 12:25:28.422 [ome.event.ItemCommandEvent] - Item 'KerstNEEOD487672e_Macros_TurnOn' received command ON
2017-12-09 12:25:28.439 [vent.ItemStateChangedEvent] - KerstNEEOD487672e_Macros_TurnOn changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2017-12-09 12:25:28.426 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.neeo.handler.NeeoDeviceHandler@18ef9fb': Client instance has been closed.
java.lang.IllegalStateException: Client instance has been closed.
	at jersey.repackaged.com.google.common.base.Preconditions.checkState(Preconditions.java:173) [177:org.glassfish.jersey.bundles.repackaged.jersey-guava:2.22.2]
	at org.glassfish.jersey.client.JerseyClient.checkNotClosed(JerseyClient.java:273) [180:org.glassfish.jersey.core.jersey-client:2.22.2]
	at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:288) [180:org.glassfish.jersey.core.jersey-client:2.22.2]
	at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:76) [180:org.glassfish.jersey.core.jersey-client:2.22.2]
	at org.openhab.binding.neeo.internal.net.HttpRequest.sendGetCommand(HttpRequest.java:60) [10:org.openhab.binding.neeo:2.2.0.201712061717]
	at org.openhab.binding.neeo.internal.NeeoBrainApi.triggerMacro(NeeoBrainApi.java:180) [10:org.openhab.binding.neeo:2.2.0.201712061717]
	at org.openhab.binding.neeo.internal.NeeoDeviceProtocol.setMacroStatus(NeeoDeviceProtocol.java:113) [10:org.openhab.binding.neeo:2.2.0.201712061717]
	at org.openhab.binding.neeo.handler.NeeoDeviceHandler.handleCommand(NeeoDeviceHandler.java:118) [10:org.openhab.binding.neeo:2.2.0.201712061717]
	at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:157) [113:org.eclipse.smarthome.core:0.9.0.201712011551]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:56) [113:org.eclipse.smarthome.core:0.9.0.201712011551]
	at com.sun.proxy.$Proxy161.handleCommand(Unknown Source) [10:org.openhab.binding.neeo:2.2.0.201712061717]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:70) [120:org.eclipse.smarthome.core.thing:0.9.0.201712011551]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [120:org.eclipse.smarthome.core.thing:0.9.0.201712011551]
	at sun.reflect.GeneratedMethodAccessor136.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:157) [113:org.eclipse.smarthome.core:0.9.0.201712011551]
	at org.eclipse.smarthome.core.internal.common.TrackingCallable.call(TrackingCallable.java:45) [113:org.eclipse.smarthome.core:0.9.0.201712011551]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]

Restarting the binding solved the issue.

@tmrobert8

The Brain lost WiFi connection today - restarted the brain and it was found at once by your binding/transport - Great!

But… is there a way to make a rule to find out if the brain is offline i.e.:

when
neeo_brain changed to OFFLINE
then

In other words: is it possible to use this in a rule:
2017-12-09 12:37:36.758 [hingStatusInfoChangedEvent] - 'neeo:brain:5x4x2x3x' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Exception occurred connecting to brain: connect timed out

Edit:
Looks like this works:

rule "Brain - Online/Offline"
when 
	System started or
	Thing "neeo:brain:5x4x2x3x" changed 
then
	var status = ThingAction.getThingStatusInfo("neeo:brain:5x4x2x3x").getStatus()
	if (status.toString() == 'OFFLINE')
		{
		 sendTelegram("bot3", "Brain offline")		
		}
	else {sendTelegram("bot3", "Brain online")}
end

@Nic_P and @Mherwege

Those issues are both the same and fixed in the final version - which hopefully will get merged for OH2.2 this friday. The github thread is now dead (github error) - so if you want the latest and greatest - check out https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/

Hi to the community and thanks for all the effort and contribution.

I am new to OpenHab2 running on Synology and I have few questions, sorry if they sound dumb.

  1. How to add Neeo Binding/Transport to openhab2
  2. Is it possible to use Neeo Brain as z-wave controller ?

Thanks
-Jay

@Jay_Choudhary

You’ll need to download the binding and transport jars from the link I posted (a few messages up - you’ll want to find the NEEO ones under the binding directory and the io directory) then place those in the “addons” directory within openHAB directory on your Synology (maybe someone else can give you guidance on how to do that).

As for the zwave controller - absolutely can be used as a zwave controller and any further help on that should be posted on planet.neeo.com rather than here.

Thanks,
Tim

@tmrobert8 ; thanks

I was able to add binding and transport. But when I go to “control” in paperUI , I don’t see anything pertaining to NEEO. Not sure if I have missed any setting or configuration.

So far I have

Neeo Transport configured - Connected OK
Neeo Binding - Neeo Brain - “Online” in Configuration/Things

Is there anything I have missed ?

On Z–wave controller, Is it possibe to add Neeo Brain as Z-WAVE controller in OpenHab2

@Jay_Choudhary
For the binding,
After you add the brain, it should discover any rooms that have devices in them - you’ll find those rooms in the paperui inbox. Once you add the room, it will discover the devices within the room and put those in your inbox. Once you add the devices - then you can see them in the control (if you want to use that).

You can’t add it as a zwave controller in openHAB - however, once you add your zwave devices to the brain, the binding will expose those to openHAB (via above) and you can then control those zwave devices from openHAB.

To use the transport - you need to go back to the root webside (localhost:8080 or whatever) and choose the NEEO icon. Then you can use the resulting pages to expose any openHAB devices to neeo

Hi, Is there anyway to include support for 1.x bindings? I’m looking to utilise the WoL functionality in openHAB, but I can’t seem to include/configure 1.x bindings in the Neeo binding.

The latest and greatest version of the transport can do 1.x bindings. Go into the transport page - hit “Add Virtual Thing” - then the “+” to add a new item - all items that you have configured should be listed (including 1.x items). You can even import your items file for easier setup.

I did use an older version, so thats useful to know. I’ll revisit it - thanks @tmrobert8

Make sure you download the https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/ version - github just fixed their error and I haven’t posted the newest on that thread yet

1 Like

@tmrobert8 ; thanks for you help

Neeo Binding is working using latest 2.2 Snapshot jars - I am able to see all my devices in Configuration/Things/Neeo
Neeo Transport is working using latest 2.2 Snapshot jars

Problem I have that I cannot see them in the control - Or I am not sure how to show them in Control.

I have added two room from my Neeo - Living Room / Bedroom and they do not show up in the Control.

Suggestion: Do you think it would be possible to add version numbers to your SNAPSHOTS as it get easier to identify which one is the latest.

Also do you think it would be nice to update your 1st (jars) link to 2.2 version as it looks like to be working fine.

Hi @tmrobert8,
I got my neeo set delivered today. Gave it a first try, unfortunately, my set top box is not supported, so I switched to play with OH a bit.
I have one comment about the way the thing/items are grouped and exposed in the neeo. Now the thing is assigned a neeo type and it is equivalent to a neeo device. This makes perfect sense for the things like roussound in your video, where the thing can be identified with a single neeo device type.
However, there are things which represent more than one neeo device type, for example lights, blinds, gate controls, etc. In my case this is a Loxone Miniserver, for which binding I am developing. I think similar situation may be with Apple home kit binding.
What generally would be very useful it to be able to create more than one neeo device per thing, with different types, and map thing items for each instance individually. I suppose this could be done by simple ‘cloning’ the thing in the Neeo transport UI. What do you think about this?
Pawel

@Jay_Choudhary
Just got back from vacation - I’ll update the first post with the latest versions later this week.

The typical process would be:

  1. Discover the brain
  2. Add the brain as a thing - this will then discover all the rooms (with devices - ie not empty rooms) in the brain and place those in your inbox
  3. Add the room as a thing - this will then create openHAB channels for all the scenarios and recipes in the room. Furthermore, it will then discover all the devices within the room and place them in the inbox
  4. Add a device as a thing - this will then create openHAB channels for all the device macros

Whether they show up in the PaperUI control is entirely dependent upon whether you have items linked to those channels. If you have paperui set to automatically link items - then they should show up after discovery (although sometimes you have to reload the page to clear paperui cache). If not, you need to link them yourself by going to the thing and clicking on the channels you want to link.

@ppieczul

Pawel,

You should be able to do this with the latest transport - simply hit the “Add Virtual Item” and then you can mix/max any registered item in the system (not as simple as ‘cloning’ but close to - a future version may allow a clone because it does sound useful).

Let me know if that didn’t make sense…

Tim

Excellent, this works very well and seems to be simpler than cloning.

I tried to play with it and have a few questions:

  • I can’t get buttons to appear on the device control panel. Switches and sliders yes, but not buttons. They will show only on the shortcuts page if I add a shortcut manually.
  • So the things get translated into a device and a recipe and thing items can be visible in a device control view, when a recipe is started and has such step inside.
    • One issue is that this adds a redundant recipe start step in the menu: room->recipe->controls, for rooms where there is nothing else but this device (lights). Any hint how to get rid of that step and go directly to the device control panel?
    • Another issue is that for many cases it would just be enough for me to have a recipe that would for example turn all first floor lights off. I could create that manually, but the thing/device items are not exposed as automation items. Would it be difficult to make them visible? Or any other way to achieve?

Thanks a lot,
Pawel