Smappee custom component

For me it’s now working since I updated from 0.60 to 0.60.1

This is something I’ve been looking for in Home Assistant. Great that it is on its way!

I’ve tried to install it (on hass.io 0.63.1), added the files manually to the custom_components folder and added the smappee configuration variables in my configuration.yaml file. Currently it is not working, I’m getting the following in the error log:

rror loading custom_components.sensor.smappee. Make sure all dependencies are installed
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/loader.py”, line 142, in get_component
module = importlib.import_module(path)
File “/usr/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 678, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/config/custom_components/sensor/smappee.py”, line 10, in
from homeassistant.components.smappee import DATA_SMAPPEE
ModuleNotFoundError: No module named ‘homeassistant.components.smappee’

I’ve tried some different configurations (smappee via host local ip only, via API only, combined…), but I’m always getting the same error. Anyone got an idea?

You need to modify a bit the files to be able to run locally. In both the switch and sensor you need to modify instead of from homeassistant.components.smappee to from custom_components.smappee and it will work.

1 Like

Thanks, changing the files did the trick!

I think the component will be in next release. It just got merged.

Thank you for your work!
I’m using the smappee component on Hass.io, and it works perfect. (Thnx to the extra tip of @ciotlosm)

Just one quick question regarding the merge. (Still newbee on HA)
I’ve put the files in the custom_components dir:
image

Will that change, or do I need to take any action? Remove the complete folder just before the update when it’s there?

just remove the custom component files related to smappee

any chance to get also “water and gaz” values in the component ?

I only have an energy monitor so it’s hard for me to test

so if someone can test the api calls out and send me the names I should be able to add it to the component

unfortunately it’s not possible to look this up in the api documentation as far as I can see

My smappee water and gaz is on the way back from the support… but I can provide my credentials if you need to test.

As far as I understand, Smappee gas & water talks to your Smappe Energy monitor (if you have one) to upload data. If you don’t have one, it uses bluetooth to talk to the Smappee app on your phone.

I use the former method (using the energy monitor as a proxy). Apart from 2 small mentions “Gas/Water sensors [serial number]” and “Gas/Water sensor RF packets received” in the ‘System Info’ section of the Smappee Energy web interface, the energy monitor does not show the gas/water meter values anywhere - not even in the http://x.x.x.x/gateway/apipublic/reportInstantaneousValues JSON…

Which kinda sucks, because that means the cloud API has to be used. The documentation has no specific information on the gas/water monitor, but there is a mention of ‘gas’ and ‘water’ in the ‘sensors’ section of the GetServiceLocationInfo response.

Maybe there’s another hidden page that shows gas/water consumption. Worst case, we’ll have to use to bluetooth to read the gas/water monitor data locally.

Just did a quick check: bluetooth service E3BA1523-2785-005B-6676-D476EABCA48E has a Read/Notify characteristic E3BA1524-2785-005B-6676-D476EABCA48E that counts up by one every time the monitor ‘pulses’ (which, in my case, means every time the 0,00x digit passes the reflective surface in the number 6). So that definitely can be an option for local monitoring.

But I’d much rather prefer to read it from the energy monitor [over the network], if possible.

With the cloud API, when you ask for :

https://app1pub.smappee.net/dev/v1/servicelocation/17873/info

You have the following answer :

{ “lon”: xxxxxxxx, “lat”: xxxxxxxx, “electricityCost”: 0.0, “electricityCurrency”: “EUR”, “timezone”: “Europe/Berlin”, “appliances”: [ { “id”: 21, “name”: “”, “type”: “Find me” }, { “id”: 19, “name”: “”, “type”: “Find me” }, { “id”: 1, “name”: “bouilloire”, “type”: “Kettle” }, { “id”: 10, “name”: “”, “type”: “Find me” }, { “id”: 23, “name”: “”, “type”: “Find me” }, { “id”: 7, “name”: “”, “type”: “Find me” }, { “id”: 26, “name”: “Microwave”, “type”: “Microwave” }, { “id”: 22, “name”: “”, “type”: “Find me” }, { “id”: 25, “name”: “”, “type”: “Find me” }, { “id”: 11, “name”: “Lights 11”, “type”: “Lights” }, { “id”: 35, “name”: “”, “type”: “Find me” }, { “id”: 24, “name”: “”, “type”: “Washing Machine” }, { “id”: 9, “name”: “”, “type”: “Find me” }, { “id”: 36, “name”: “”, “type”: “Find me” }, { “id”: 29, “name”: “”, “type”: “Find me” }, { “id”: 18, “name”: “”, “type”: “Find me” }, { “id”: 32, “name”: “”, “type”: “Find me” }, { “id”: 6, “name”: “”, “type”: “Find me” }, { “id”: 16, “name”: “”, “type”: “Find me” }, { “id”: 12, “name”: “”, “type”: “Refrigerator” }, { “id”: 13, “name”: “”, “type”: “Find me” }, { “id”: 17, “name”: “”, “type”: “Find me” }, { “id”: 27, “name”: “”, “type”: “Find me” }, { “id”: 4, “name”: “”, “type”: “Refrigerator” }, { “id”: 2, “name”: “”, “type”: “Find me” }, { “id”: 30, “name”: “”, “type”: “Find me” }, { “id”: 15, “name”: “Refrigerator”, “type”: “Refrigerator” }, { “id”: 14, “name”: “”, “type”: “Find me” }, { “id”: 33, “name”: “”, “type”: “Find me” }, { “id”: 3, “name”: “Refrigerator”, “type”: “Refrigerator” }, { “id”: 8, “name”: “”, “type”: “Find me” }, { “id”: 28, “name”: “”, “type”: “Washing Machine” }, { “id”: 34, “name”: “”, “type”: “Find me” }, { “id”: 5, “name”: “”, “type”: “Find me” }, { “id”: 31, “name”: “”, “type”: “Find me” }, { “id”: 20, “name”: “”, “type”: “Find me” } ], “actuators”: [], “sensors”: [ { “id”: 4, “name”: “3004003009”, “channels”: [ { “name”: “Water”, “ppu”: 1000.0, “uom”: “m3”, “enabled”: true, “type”: “water”, “channel”: 1 }, { “name”: “Water”, “ppu”: 1000.0, “uom”: “m3”, “enabled”: true, “type”: “water”, “channel”: 2 } ] } ], “monitors”: [], “serviceLocationId”: 17873, “name”: “Home” }

After, when you ask for :

https://app1pub.smappee.net/dev/v1/servicelocation/17873/sensor/4/consumption?aggregation=3&from=’${yesterdaytime}’&to=’${endtime}

you have the following answer :

{ “serviceLocationId”: 17873, “sensorId”: 4, “records”: [ { “timestamp”: 1519858800000, “value1”: 10.0, “value2”: 48.0, “temperature”: 124.0, “humidity”: 33.6, “battery”: 100.0 } ] }

which give you the measured value of the channel 1 (value1) and the channel2 (value2) of the smappee water and gaz. (I use it for cold and warm water used in my home)

On HA, I get :

58

It looks like it should be possible to add to the sensor component without too much trouble

Could I get you to try enabling debug in home assistant and dump the log line from the smappee component that looks like :

“Remote consumption %s %s”

2018-03-01 11:04:53 DEBUG (Thread-19) [homeassistant.components.smappee] Remote info {17873: ‘Home’} {17873: {‘appliances’: [{‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 21}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 19}, {‘type’: ‘Kettle’, ‘name’: ‘bouilloire’, ‘id’: 1}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 10}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 23}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 7}, {‘type’: ‘Microwave’, ‘name’: ‘Microwave’, ‘id’: 26}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 22}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 25}, {‘type’: ‘Lights’, ‘name’: ‘Lights 11’, ‘id’: 11}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 35}, {‘type’: ‘Washing Machine’, ‘name’: ‘’, ‘id’: 24}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 9}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 36}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 29}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 18}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 32}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 6}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 16}, {‘type’: ‘Refrigerator’, ‘name’: ‘’, ‘id’: 12}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 13}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 17}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 27}, {‘type’: ‘Refrigerator’, ‘name’: ‘’, ‘id’: 4}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 2}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 30}, {‘type’: ‘Refrigerator’, ‘name’: ‘Refrigerator’, ‘id’: 15}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 14}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 33}, {‘type’: ‘Refrigerator’, ‘name’: ‘Refrigerator’, ‘id’: 3}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 8}, {‘type’: ‘Washing Machine’, ‘name’: ‘’, ‘id’: 28}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 34}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 5}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 31}, {‘type’: ‘Find me’, ‘name’: ‘’, ‘id’: 20}], ‘lon’: xxxxxxxxx, ‘timezone’: ‘Europe/Berlin’, ‘monitors’: [], ‘actuators’: [], ‘name’: ‘Home’, ‘electricityCost’: 0.0, ‘sensors’: [{‘name’: ‘3004003009’, ‘id’: 4, ‘channels’: [{‘channel’: 1, ‘name’: ‘Water’, ‘enabled’: True, ‘ppu’: 1000.0, ‘type’: ‘water’, ‘uom’: ‘m3’}, {‘channel’: 2, ‘name’: ‘Water’, ‘enabled’: True, ‘ppu’: 1000.0, ‘type’: ‘water’, ‘uom’: ‘m3’}]}], ‘lat’: xxxxxxxxx, ‘serviceLocationId’: 17873, ‘electricityCurrency’: ‘EUR’}}
2018-03-01 11:04:54 DEBUG (Thread-19) [homeassistant.components.smappee] Remote consumption {17873: ‘Home’} {‘consumptions’: [{‘consumption’: 29905.8, ‘timestamp’: 1519858800000, ‘alwaysOn’: 2520.0, ‘solar’: 0.0}], ‘serviceLocationId’: 17873}

seems to be “easy” to get those values I think :slight_smile: (for people who knows pithon)

yes it should be easy enough, the only problem is that it takes more remote calls, as they don’t collect everything in one place

Only one more call I think

it depends on how many sensors you have so it would be 1 per sensor

does anyone have a gas sensor, I can get some data from?

With gaz, it’s the same behavior. The plug to get data are the same. I can set up in the app gaz instead of water and I get the same behavior.