Smappee custom component

but I would expect the channels to have different values? as I would expect there to be different options when measuring gaz

can do the test tonight if you want

that would be nice, just to make sure I can handle all of it

at least the icons for the different sensors need to be different depending on what is measured

16

It should work now for water sensors

if you wan’t to test it, you can get the updated component from this branch https://github.com/hmn/home-assistant-dev/tree/smappee-add-sensor

the values are read from the cloud api

the battery level of the “water and gaz” device.

Temperature and humidity graph

Your Gas & water monitor also measures the air temperature and humidity level. This data is also presented in a graph, which might be of interest if your monitor is installed somewhere where it is exposed to heat or cold and/or damp, such as outdoors or in an unheated space.

Hi!

Great component, but I have some troubles with it.
I’m using Smappee energy monitor in typical 3-phase star configuration if it matters.

below is extract from HA.log:

8-03-12 23:48:13 ERROR (MainThread) [homeassistant.components.sensor] smappee: Error on device update!
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 188, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.6/asyncio/futures.py”, line 332, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/sensor/smappee.py”, line 135, in update
voltage = self._smappee.active_voltage()
File “/usr/lib/python3.6/site-packages/homeassistant/components/smappee.py”, line 324, in active_voltage
properties = self.instantaneous_values()
File “/usr/lib/python3.6/site-packages/homeassistant/components/smappee.py”, line 299, in instantaneous_values
report_instantaneous_values[‘report’].split(’
’)
KeyError: ‘report’
2018-03-12 23:48:13 ERROR (MainThread) [homeassistant.components.sensor] smappee: Error on device update!
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 188, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.6/asyncio/futures.py”, line 332, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/sensor/smappee.py”, line 155, in update
value1 = [float(i[‘value’]) for i in data
File “/usr/lib/python3.6/site-packages/homeassistant/components/sensor/smappee.py”, line 156, in
if i[‘key’].endswith(‘phase3ActivePower’)]
TypeError: string indices must be integers

HA version 0.65.3
Python 3.6.3

What’s wrong in my config?

Not sure if this has been included in the latest HA release, but I can only see the electric stuff (haven’t tried the dev version)

[edit]Never mind, just checked the commits, it appears only water sensor has been added, not gas. My bad :)[/edit]

Seems to be the local api. Have you added host_password to your config?
If host_password has spaces, put it in single quotes.
If that doesn’t work, just try without; it should just use the cloud api then.

Hi, thanks for your work the compnent works fine ( mostly )

This is my problem i receive in my logs on every startup:

> 2018-05-07 18:23:39 WARNING (MainThread) [homeassistant.setup] Setup of config is taking over 10 seconds.
> 2018-05-07 18:24:02 WARNING (MainThread) [homeassistant.setup] Setup of zwave is taking over 10 seconds.
> 2018-05-07 18:24:36 ERROR (MainThread) [homeassistant.components.sensor] smappee: Error on device update!
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 244, in _async_add_entity
>     await entity.async_device_update(warning=False)
>   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
>     yield from self.hass.async_add_job(self.update)
>   File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
>     result = self.fn(*self.args, **self.kwargs)
>   File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/smappee.py", line 192, in update
>     consumption = data.get('records')[-1]
> IndexError: list index out of range
> 2018-05-07 18:24:37 ERROR (MainThread) [homeassistant.components.sensor] smappee: Error on device update!
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 244, in _async_add_entity
>     await entity.async_device_update(warning=False)
>   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
>     yield from self.hass.async_add_job(self.update)
>   File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
>     result = self.fn(*self.args, **self.kwargs)
>   File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/smappee.py", line 192, in update
>     consumption = data.get('records')[-1]
> IndexError: list index out of range
> 2018-05-07 18:24:37 ERROR (MainThread) [homeassistant.components.sensor] smappee: Error on device update!
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 244, in _async_add_entity
>     await entity.async_device_update(warning=False)
>   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
>     yield from self.hass.async_add_job(self.update)
>   File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
>     result = self.fn(*self.args, **self.kwargs)
>   File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/smappee.py", line 192, in update
>     consumption = data.get('records')[-1]
> IndexError: list index out of range
> 2018-05-07 18:24:37 ERROR (MainThread) [homeassistant.components.sensor] smappee: Error on device update!
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 244, in _async_add_entity
>     await entity.async_device_update(warning=False)
>   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
>     yield from self.hass.async_add_job(self.update)
>   File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
>     result = self.fn(*self.args, **self.kwargs)
>   File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/smappee.py", line 192, in update
>     consumption = data.get('records')[-1]
> IndexError: list index out of range
> 2018-05-07 18:24:37 ERROR (MainThread) [homeassistant.components.sensor] smappee: Error on device update!
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 244, in _async_add_entity
>     await entity.async_device_update(warning=False)
>   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
>     yield from self.hass.async_add_job(self.update)
>   File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
>     result = self.fn(*self.args, **self.kwargs)
>   File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/smappee.py", line 192, in update
>     consumption = data.get('records')[-1]
> IndexError: list index out of range
> 2018-05-07 18:25:24 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting

But after that the component works fine, i only had one problems that half of the sensors stopped upading after 4 days ( a reset solved it )

For reference: also see issue #14426

I’m not a python wizard, but it seems the Smappee component needs a lot more null checks :slight_smile:

Anyway, it seems that Smappee now has the ability to publish to MQTT as well. I have some documentation, sent to me by the Smappee guys/gals, that shows how to configure the broker address, and what topics Smappee publishes/subscribes to. It now seems possible to control the ‘smart plugs’ locally (via MQTT) as well.

Anyway, I noticed the smappee component uses the Smappy lib to fetch data. Do you guys think the MQTT stuff should be implemented in the custom component, or is the Smappy lib a better fit?

is the water and gaz component can also publish to MQTT ?

Are you able to share how to enable and configure MQTT on Smappee ?

As far as I can tell, only electricity/solar so far.

Sure, but this forum won’t let me upload pdf’s…
What’s a good way to share those?

Probably the best approach would be to put it on dropbox, google drive or something similar.

Hi:
I’m just new to HA. I have an Smappee monitor and the only thing I want to get is the instantaneous activepower, read every second. I have a 1 phase installation (typical in Spain) and I have the feeling, by looking over the code, that the parsing of instantaneous values in only valid for a 3 phase house. Am I right?
I guess I have to customize the code for my 1 phase and change the SCAN_INTERVAL from 30 to 1. Is this the right approach?
Thanks
PS - I show here an extract from the reply when reading instantaneous values in my smappee:

{u’report’: u’Instantaneous values:
voltage=242.2 Vrms
FFTComponents:
Phase 1:
\tcurrent=1.17 A, activePower=220.937 W, reactivePower=177.77 var, apparentPower=283.576 VA, cosfi=77, quadrant=0, phaseshift=0.0, phaseDiff=0.0
\tFFTComponents:


Phase 1, peak active power 4636.621 W at 10/03/2018 14:11:45
active energy RMS per phase mapping combination
phase mapping -1=0.0 kWh [* 1/0]
phase mapping -1=0.0 kWh [ 1/0]
phase mapping -1=0.0 kWh [ 1/0]
phase mapping -1=0.0 kWh [ 1/0]
phase mapping -1=0.0 kWh [ 1/0]
phase mapping -1=0.0 kWh [ 1/0]

active energy RMS (solar) per phase mapping combination
phase mapping -1=0.0 kWh [* 1/0]
phase mapping -1=0.0 kWh [ 1/0]
phase mapping -1=0.0 kWh [ 1/0]
phase mapping -1=0.0 kWh [ 1/0]
phase mapping -1=0.0 kWh [ 1/0]
phase mapping -1=0.0 kWh [ 1/0]

’}

Just to let people know Smappee will change their API to paid service so they wont give out API keys anymore. The MQTT that is documentated for their plus module is free and available for all products, except the plus also got a broker.

I just got this information today when asking for an API key.

1 Like

So this will affect only this custom component or also the “official” HA component?