HTTP or EXEC Binding for EDMIAX Smart Plug SP-1101W?

Hi,

I´m using Edimax Plug SP-1101W with the following workaround via CMD from PC:

curl -d @EDI_On.xml http://admin:xxxx@192.168.0.20:10000/smartplug.cgi

with EDI_On.xml like:
`

<?xml version="1.0" encoding="utf-8"?> ON ` How can I convert this to a HTTP binding? Or exec binding? Or are there better solutions in openHAB for the use of EDIMAX plugs?

Thank you in advance for your help!

jo

PS: Sorry, I´m a total newbie with openHAB!

You cannot pass a body (i.e. your XML) using the HTTP binding so you will want to use the Exec binding. See the Exec Binding wiki page for examples and documentation for how to use it to call curl.

I recently created an own binding for my edimax SP-2101W - it may also work well with your SP-1101W, because the protocol is fairly the same. So if you’re interest check GitHub - derHeinz/openhabplugins: Plugins to openhab or contact me.

any chance to get a prepackaged .jar which can be easily used and a small tutorial? Dont have a working development enviroment for openhab.

Sure, created a release for that. See:

Thank you :slight_smile:

Did it work for you?

yes it works :slight_smile:

but a little suggestion:
i dont know why, but i dont get a discovery message, albeit seeing one in the sourcecode. If i add the configuration parameters for ping discovery it doesnt work at all, but if i remove the parameters, it works pretty well. Dunno if this is a bug or not. Maybe with the configuration parameters the normal discovery is disabled?

I suggest submitting the handler to the openhab repo. Good job!

Thanks for your comments.
I think the logger has to be configured to output messages of level like INFO. By default none of the logmessages are shown except the message is above a certain level.
Your’re right the ping discovery deactivates the udp discovery. I consider removing the ping-like disocvery completely.

1 Like

Great stuff, thank you very much! :slight_smile:

Any chance you can create a OH2 addon for edimax smart plug ? Thanks.

I’m not (yet) into OH2 but isn’t there this compatibility layer which allows to use OH1 bindings? Maybe I’ll try this once I have a testinstallation of OH2.

Yes there is. Any OH 1 binding should work with OH 2.

Its not working but maybe due to operator error.

Here is what I did:

  1. My openhab2 runs on raspberry pi. Transferred edimax 1.7.1 addon to addon folder.
  2. Created edimax.cfg with ipprefix, ipstart, ipend.
  3. Created item with “Switch EdimaxSimple {edimax=“01234567ABCD”}” (I am assuming 01234567ABCD is the mac id).
  4. Added to sitemap with "Switch item=EdimaxSimple"
    It does not switch on or off the plug. I can control the plug with ios app, so I know the plug works.
    Also, edimax is not auto discovered like wemo plugs in openhab 2.

Any suggestions ? Thanks.

Here is the portion of openhab log:
[WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Exception during event dispatch [org.osgi.service.event.Event [topic=openhab/command/EdimaxSimple] | {org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler}={event.topics=openhab/command/*, service.pid=org.openhab.edimax, component.name=org.openhab.binding.edimax, component.id=195, service.id=381, service.bundleid=221, service.scope=bundle} | Bundle(org.openhab.binding.edimax_1.7.1.201601011151 [221])]
java.lang.NullPointerException
at org.openhab.binding.edimax.internal.EdimaxBinding.getDeviceIP(EdimaxBinding.java:175)[221:org.openhab.binding.edimax:1.7.1.201601011151]
at org.openhab.binding.edimax.internal.EdimaxBinding.changeValue(EdimaxBinding.java:197)[221:org.openhab.binding.edimax:1.7.1.201601011151]
at org.openhab.binding.edimax.internal.EdimaxBinding.internalReceiveCommand(EdimaxBinding.java:187)[221:org.openhab.binding.edimax:1.7.1.201601011151]
at org.openhab.core.binding.AbstractBinding.receiveCommand(AbstractBinding.java:97)[199:org.openhab.core.compat1x:2.0.0.201606271614]
at org.openhab.core.events.AbstractEventSubscriber.handleEvent(AbstractEventSubscriber.java:42)[199:org.openhab.core.compat1x:2.0.0.201606271614]
at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415)[3:org.apache.karaf.services.eventadmin:4.0.4]
at org.apache.felix.eventadmin.impl.tasks.HandlerTask.run(HandlerTask.java:90)[3:org.apache.karaf.services.eventadmin:4.0.4]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_65]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_65]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]

Hi,

First you should not use the ipprefix thing it did not work properly.
And second: it doen’t work, and I get the same error:

It seems like the runtime behaves slightly different than in 1.x and there are 2 instances of the binding class present.
One that is called periodically due to beeing an AbstractActiveBinding which properly discovers devices
(and stores them into a field) but cannot access the configuration through provider.getItemNames(). The list is just empty.
The other one is called when something is changed (e.g. by the UI) and it can indeed access the configuration but due to it not beeing the same instance it has no discovered devices and thus crashes.

Is this intended ('cause in OH1x you get the same instance in both cases) or should it be like in OH1x and there is some other issue here, e.g. with the osgi-inf files or the like?

Hopefully one of the Openhab gurus can help us…

See this release which works for me with the OH2

1 Like

Thanks for OH2 binding. It works. I added the .jar and followed creating items manually for switch, current and power. Added that to my sitemap and I am able to turn on/off, read power and current.

Reporting back that this binding is working smoothly for the last 15 days. Thanks @hserfas

1 Like

any chance to get an update with interface selection for the binding? After setting a new device in linux the binding stopped working (unable to find)