[RESOLVED] New Binding with ThingHandler Implements EventSubscriber

Tags: #<Tag:0x00007f3878b332d0> #<Tag:0x00007f3878b33028>

Hi,

I am creating a new binding with custom “event” which i like to send and receive via the event bus. But, i am hitting the following error. So, i am not sure whether this is a right way to do and hopefully someone with experience can provide me some pointers. Cheers. (NOTE: I have tried on custom class with EventSubscriber and it is working but not on ThingHandler inherited class)

!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.ServiceException: org.apache.felix.scr.impl.manager.SingleComponentManager.getService() returned a service object that is not an instance of the service class org.eclipse.smarthome.core.events.EventSubscriber
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:243)
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111)
at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:45)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:524)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:461)
at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:624)

NewThingHandler.java
public class NewThingHandler extends BaseThingHandler implements EventSubscriber {

@Override
public Set getSubscribedEventTypes() {
return subscribedEventTypes;
}

            @Override
            public EventFilter getEventFilter() {
                return null;
            }

            @Override
            public void receive(Event event) {
            }
        }

and then on OSGI-INF i have the following defined:
<scr:component xmlns:scr=“http://www.osgi.org/xmlns/scr/v1.2.0” configuration-pid=“newthing”>

      <service> 
          <provide interface="org.eclipse.smarthome.core.events.EventSubscriber"/>
     </service>
 .....
</scr:component>

There is one whole topic talking about it.