Smappee custom component

I created a custom component for http://www.smappee.com energy monitor

It can control the Comfort Plugs and read latest power usage the api gives access to

6 Likes

Great! that what i am looking for!
But i can get it working.
I just started with home assistant so maybe i made a mistake somewhere?
can you help me somewhere to get this working?

Any chance for this to be added to home assistant as a component?

1 Like

Thanks for sharing your code, I’ve managed to get the comfort plug working but the sensor gives me an error. Any chance for some help ?

i will try this out this weekend too… thanks for the code…

First thank you for the code, would really be nice to integrate my Smappee in Home Assistant, but for me its’nt working, I receive this error:

Error while setting up platform smappee
Traceback (most recent call last):
File “/usr/src/app/homeassistant/helpers/entity_component.py”, line 171, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/sensor/smappee.py”, line 38, in setup_platform
dev.append(SmappeeSensor(smappee, location_id, sensor))
File “/config/custom_components/sensor/smappee.py”, line 54, in init
self.update()
File “/usr/src/app/homeassistant/util/init.py”, line 306, in wrapper
result = method(*args, **kwargs)
File “/config/custom_components/sensor/smappee.py”, line 92, in update
consumption = data.get(‘consumptions’)[-1]
IndexError: list index out of range

Any Idea?

I’m on HomeAssistant 0.60 in a docker container on my Synology NAS.

it looks like you are not getting data from smappee, so I would expect you have a wrong config or maybe missing/wrong api credentials from smappee

the strange thing is that then the component should just have failed completely, so witht he input you have given I don’t really know what your problem is

@hmn I’m really interested in helping getting a PR to add this component into HA. Are you willing to collaborate?

@ciotlosm sure, I I think it should just be a matter of generating some hass documentation other than that I guess it should follow most of the std component rules

but it’s been a while since I last looked into it so it might have changed

2 Likes

I am willing to write documentation. I only have the Smappee energy monitor unfortunately. We could add some automatic tests and cover a few corner cases to improve error handling probably.

1 Like

ok, thanks anyway for the response. Smappee Support gave me als cliend_id the same like my username is, can that be possible - or do you think they did a misstake?

great to see someone is working on this.
i also didnt get it to work!

I added the module and documentation so you can take a look at it and send pull requests for any updates, then i’ll look into sending it to the official repos


https://github.com/hmn/home-assistant-dev/tree/smappee
1 Like
1 Like

I’ve corrected some pylint errors reported on build. I’ll test a bit locally then request a merge in your branch.

Later edit: I have to wait now for support to provide me a client_id. I have a local build running to check for more errors.

Added https://github.com/hmn/home-assistant-dev/pull/1
Verified with https://travis-ci.org/ciotlosm/home-assistant/builds/325863482

I’m adding support to allow you to see local data if you don’t want to have cloud. You should still get benefit of active load and probably amps and voltage.

Update:

  • Renamed some sensors to be more accurate with actual representation (current -> active power)
  • Added current and voltage
  • Improved error handling
  • Allowed local and remote servers to be optional

29

Working on a way to allow switches to be controlled locally without the use of Smappee servers. Currently I can turn them on or off but state is not being updated if they are controlled from somewhere else.

Added a patch to smappy library: https://github.com/EnergieID/smappy/pull/23

Seems the pull request should be completed with the desired support for both remote and local usage (or combined). Now we have to get a few reviewers and we should be able to soon see Smappee officially in Home-Assistant :slight_smile:

Thanks to @hmn for making this possible!

For those interested, here is the code pull request:
https://github.com/home-assistant/home-assistant/pull/11491

For anyone interested in getting this working before it makes it’s way into a release, ping me on discord