Plugwise Smile P1 integration DSMR4 slimme meter

@Gernimo2018 Thanks for this!

Can you please take a look at my error log?

Log Details (ERROR)
Tue May 22 2018 15:36:58 GMT+0200 (CEST)

Error loading custom_components.sensor.plugwisesmile. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 86, in get_component
    module = importlib.import_module(path)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/custom_components/sensor/plugwisesmile.py", line 30, in <module>
    from lxml import etree
ImportError: No module named 'lxml' 

I tried:

apt-get install python-dev libxml2 libxml2-dev libxslt-dev
pip install lxml
pip3 install lxml
sudo apt-get install python-lxml

Can’t get it to work.

I’m getting the next error log. I think it’s because the API changed

    2018-07-04 13:55:52 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform plugwisesmile
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/plugwisesmile.py", line 169, in setup_platform
    entities.append(PlugwiseSmileSensor(data, sensor_type))
  File "/config/custom_components/sensor/plugwisesmile.py", line 239, in __init__
    self.update()
  File "/config/custom_components/sensor/plugwisesmile.py", line 271, in update
    self.data.update()
  File "/usr/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 319, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/sensor/plugwisesmile.py", line 190, in update
    self._gas_module = self._api.get_gas_module()
  File "/config/custom_components/sensor/plugwisesmile.py", line 95, in get_gas_module
    module_id = modules_xml.xpath('//modules/module[count(./services/gas_interval_meter)>0]/@id')[0]
IndexError: list index out of range

https://www.plugwise.com/nl_NL/product_support#path=apps_source[40]

source code is not suported anymore
helaas

I have modified the code from Jeroen van der Schoot so it should work on a recent Home Assistant version. Please go here and try it: https://github.com/bouwew/smilep1

I think this will work for a v2. Anyone with a v3 willing to test?

Any questions, issues, let me know in this topic.

Hi Bouwe,
It’s been a while since you created the new version of this integration.
I’ve recently started with Home Assistant and wanted to install this for my V3.
Can’t get it to work, though. Have you had confirmation in the meantime that it should work? Otherwise I’m more than happy to test any further integration to the V3 version. Would you be willing to adapt it?

Hi Marc,

I can do you one better, please go here: Plugwise Smile custom_component (BETA)

This new Plugwise custom_component supports the Smile P1 v2 and v3, the old and present Anna and the Adam + Lisa + Tom/Floor + Plugs.

That’s just awesome!
Got it working. Tempted to shout out other integrations that I’m looking for, just to see if you’ve covered those as well :wink:

Anyway, back to the beta plugwise integration. I do think that some entities are missing. When I have a look at the plugwise smile tests page, I can also see that my setup is orange. I have this setup: electricity, solar and gas ( p1_full_option )
Would it help if I send the files required for that?

Which entities are you missing?
And yes, providing xml-data would definitely help.
Please save the xml-data via right-click --> save as --> xml-file

@CoMPaTech where should this data go?

If @mvieleers can commit them as a PR to https://github.com/plugwise/Plugwise-Smile/tests/p1_full_option that would be great. Simpeler might be to just save the XML files as indicated by both @bouwew above and on the README in https://github.com/plugwise/Plugwise-Smile/tests/ in a zip and attach that to an issue in that repo. Please clean at least your smile-id and some personal data (see that same readme), we’ll have to do that anyway before committing it but I’d rather not publish your smile-id :slight_smile:

Created an issue in the github and attached the files as well as some info on the entities I am missing.

Let me know if I missed anything. Thank you for all your efforts!

Please test plugwise-beta version 0.1.11.

Great effort! All electricity values are displayed now. Gas is not showing though.

new release 0.1.11p also shows gas.
Great job!

Hi fellow P1’s

As @mvieleers indicated yes we support more and more, and just released our new version. Check out the ‘other topic’ for future updates or head directly to https://github.com/plugwise/plugwise-beta/releases/tag/0.2.0 to read the release notes (it is a breaking update and requires HA 0.109 coming out of beta wednesday).

For all our Dutchies around, happy Woningsdag!

How can I convert the sensor.p1_net_electricity_point to kWh per day / month etc ??

if I try :

  • platform: template
    sensors:
    used_energy_today:
    friendly_name: “Today”
    unit_of_measurement: “kWh”
    value_template: “{{ states(‘sensor.p1_net_electricity_point’) | float / 1000 }}”
    icon_template: mdi:flash

How can I get this done ??

thnx

Its not giving my daylight usage, but a very different value. :frowning:

The xyz_point_sensors provide values with the unity Watt.
To turn the values of such a sensor to kWh you need to integrate over time, 1hr. And divide by 1000. So you are doing the 2nd part correct but the 1st part is missing.
Please have a look here: https://www.home-assistant.io/integrations/integration/

Next, you need to integrate once more time, over the time interval you are interested in: 1 day, 1 month, etc.
Please have a look here: https://www.home-assistant.io/integrations/utility_meter/

so in sensors :

  • platform: template
    sensors:
    gebruikte_energie_vandaag_test:
    friendly_name: “Vandaag energy”
    unit_of_measurement: “kWh”
    value_template: “{{ states(‘sensor.p1_net_electricity_point’) | float / 1000 }}”
    icon_template: mdi:flash

  • platform: integration
    source: sensor.gebruikte_energie_vandaag_test
    name: Energie per dag
    unit_prefix: k
    round: 2

and then in utility :

dag_energie_verbuik:
source: sensor.energie_per_dag
cycle: daily

should do the trick ??

As bouwe said, look at https://www.home-assistant.io/integrations/utility_meter/ and the example given, that should give you something like:

utility_meter:
  energy:
    source: sensor.p1_net_electricity_point
    cycle: daily

Specifically see https://www.home-assistant.io/integrations/utility_meter/#advanced-configuration-for-dsmr-users which might make it very easy to copy and paste - especially the second code fragment :slight_smile: Saves you the calculation and the setting of prefixes etc.

No that doesn’t work.
First you need to create the kWh-sensor:

  - platform: integration
    name: net_elect_kwh
    source: sensor.p1_net_electricity_point
    unit_prefix: k
    unit_time: h
    round: 1

Change to name to you liking.

This should give you the kWh-sensor that you can use in the next step, in creating the kWh-counters for a day, week, etc. using the Utility Meter integration.

1 Like

It seems this does not report negative energy?? When also having solar panels ??? It yust stays at 0