Smappee Binding

Discussion about the smappee binding

1 Like

If you want to test this module, instructions can be found in this pull request -> https://github.com/openhab/openhab2-addons/pull/2815

Great job NTanghe! Download worked fine for me:

pi@raspberrypi3:/usr/share/openhab2/addons $ sudo wget https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.smappee/2.2.0-SNAPSHOT/org.openhab.binding.smappee-2.2.0-SNAPSHOT.jar
pi@raspberrypi3:/usr/share/openhab2/addons $ sudo chown openhab:openhab -c org.openhab.binding.smappee-2.2.0-SNAPSHOT.jar
pi@raspberrypi3:/usr/share/openhab2/addons $ ls -l
insgesamt 140204
-rw-rw-r-- 1 openhab openhab 143544051 Jun 27 23:14 openhab-addons-2.1.0.kar
-rw-r--r-- 1 openhab openhab     20445 Okt 30 20:25 org.openhab.binding.smappee-2.2.0-SNAPSHOT.jar
-rw-r--r-- 1 openhab openhab        70 Jun 27 23:+1: 3 README

I will configure later this week and give feedback.

Do you also have examples of item config?

ok, items samples added here -> https://github.com/openhab/openhab2-addons/pull/2815

Thanks! How would you set the poll frequency and any idea when/how you will be getting the different devices in Openhab?

@pallie42 I will add a possibility to modify the poll frequency, at this moment itā€™s set fixed to every 2 minutes.
The smappee binding will only display the total energy consumption, the energy consumption that is ā€˜always onā€™, and the solar power you produce.
The devices the smappee detects automatically are not added automatically as things, because in my home, this would mean 70+ devices are added automatically to openhab. And Iā€™m not even sure these are unique devices. maybe the binding can only add the identified devices from my smappee and ignore the detected but unidentified devices ? Any ideas on this are welcomeā€¦

Hello and many tanks for your mail.
But I have problems with the installation. I put the jar-File into the addon folder, make an upgrade, but the openhab binding will not be installed.
What am I doing wrong?

The download worked for me too, but the binding can not be installed. Have you already done an installation and could you explain the way? Thank for your support.

just putting it in the addon folder should be enough.
what does the bundle:list command says in karaf ?

Karaf find the binding: 181 | Active | 80 | 2.2.0.201711090958 | Smappee Binding

But the in Paper UI Add-ons / BINDINGS I cant find it.

Karaf find the binding: 181 | Active | 80 | 2.2.0.201711090958 | Smappee Binding
But the in Paper UI Add-ons / BINDINGS I cant find it.

Good news, the smappee binding works. But I have another question. Itā€™s possible to connect the smappee switches?

To be implemented :

  • The detected appliances donā€™t appear as seperate devices in openhab.

This would generate way too much devices in openhab

  • The plugs can not be controlled with this binding.

Because I donā€™t use those plugs, But on request, I can have a look to implement this for you, There must be at least one of those plugs lying around hereā€¦

A solution with these plugs would be glad.
One thing has struck me, at times a very long number is shown e.g. 123.0000000000000001 (Item EnergyConsumptionChannel).

spikes are possible, it can happen when a heavy duty appliance is switched on.
But it should be only a few 1000 watts, 123 watt is not that high btwā€¦

this is how it looks like in here :

If you refer to the number of decimals, I get this tooā€¦
These numbers come from the smappee itself, maybe It can be rounded by the bindingā€¦

I refer to the numbers of decimals. A rounded or a fix number of decimals would very good.

Hey there,
I already do own a Smappee and also have API credentials. Iā€™m not too sure what is needed for ā€œlocation id nameā€. Do you mean the name from https://smappee.atlassian.net/wiki/spaces/DEVAPI/pages/8552475/Get+Servicelocations?
My reply looks different than the one from the docu

{
ā€œappNameā€: ā€œMyFirstAppā€,
ā€œserviceLocationsā€: [
{
ā€œserviceLocationIdā€: $NUMERIC,
ā€œnameā€: ā€œStartseiteā€
}
]
}

The Thing sais: ā€œOFFLINE - CONFIGURATION_ERROR Could not find a smappee with configured service location nameā€
And openhab bails out with some NullPointers:

2017-11-20 22:05:34.817 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling thing updated at ThingHandler 'org.openhab.binding.smappee.handler.SmappeeHandler@563d94f1': java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)[:1.8.0_121]
        at java.util.concurrent.FutureTask.get(FutureTask.java:206)[:1.8.0_121]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:194)[98:org.eclipse.smarthome.core:0.9.0.b5]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)[98:org.eclipse.smarthome.core:0.9.0.b5]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)[98:org.eclipse.smarthome.core:0.9.0.b5]
        at org.eclipse.smarthome.core.thing.internal.ThingManager.thingUpdated(ThingManager.java:524)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
        at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyTrackers(ThingRegistryImpl.java:221)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
        at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:144)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
...

Would love to have my Smappee data in OH!
Back then I filed a ticket asking for direct item consumption access. They only answered that they will put it on the feature request list.

It should fail more gracefully, I agree, i will have a look on that. Sorry for that.

your response from the ServiceLocations Api looks ok, I assume that there is a unique identifier in $NUMERIC :

{
     "appName": "MyFirstApp",
     "serviceLocations": [
       {
             "serviceLocationId": 12345,
             "name": "Home"
       }
       ]
} 

So, in your case Location name would be ā€œStartseiteā€, Use this in your binding configuration, this should also be the name that you see in the title of your MySmappee app.

At this moment the smappee binding only displays overall consumption / Solar power gains. Iā€™m not sure what to do with all those devices that my smappee seems to detect in my homeā€¦ Autodetect them all as new items in OpenHab is not a good idea, I think.
So at this moment, you can not see the consumption of the individual appliances. Suggestions how to implement this are very welcome.

I think there must be an API method available for this, since the MySmappee app can display the consumption of each individual appliance.

Thanks for your reply. I already set Startseite as Service location name and restarted the binding via console. But no change in behavior. Will do a full OH restart to verify once more.

I think it shouldnā€™t be necessary to manually configure the ā€œservice location nameā€, as you can poll it via API. Just authenticate and poll this info from the API. One step less to configure.

Back then, when I wrote some perl scripts to poll data, there was no API function to poll device specific data. Thus I created a feature request. Not sure, if they did some homework on this already.
And that they have this function internally doesnt mean they have made it public avail though the API they offer.

In case there is functionality, I also cant recommend auto-adding all devices into the inbox. An idea would be to only auto-add devices that are properly recognized and named. e.g : itemname != ā€œDevive *ā€.
If one can copy&paste the itenmame from my.smappee.com to item config of OH2 would be easy to manually create items.

I really appreciate your work on Smappee binding. Let me know if I can be of any help!.
Thanks much

Edit: Seems like GetSensorConsumption might help to retrieve device specific data: https://smappee.atlassian.net/wiki/spaces/DEVAPI/pages/34504708/Get+Sensor+Consumption