De Windcentrale

I made a sensor for the output of the shared wind-turbine or windmill from the Windcentrale, also called Winddeler. The wind-turbine is in my case called De Jonge Held, or short ‘djh’ in my code. For this wind turbine there are 10154 shares of which I own 3, hence the 3 * 10154 in the code to calculate the power. When you own shares in one of the other windmills you need to change the URL in the resource. I found mine here: https://github.com/damonnk/windcentrale/blob/0ff9239b2fe5d8ffc05ccbaa9b8bac09cba7796f/molens.xml however I had to change the 21 to 2 for de jonge held.

My relevant part out of sensors.yaml

- platform: rest
  name: djh
  json_attributes:
    - windSpeed
    - windDirection
    - powerAbsTot
    - powerAbsWd
    - powerRel
    - diameter
    - rpm
    - pulsating
    - hoursRunThisYear
    - runPercentage
  resource: https://zep-api.windcentrale.nl/production/2/live
  value_template: '{{ value_json.powerAbsTot }}'
  unit_of_measurement: "kW"

- platform: template
  sensors:
    djh_speed:
      friendly_name: 'Wind Snelheid'
      value_template: '{{ states.sensor.djh.attributes["windSpeed"] }}'
      unit_of_measurement: "bft"
    djh_mypower:
      friendly_name: 'Wind Power'
      value_template: '{{ (states.sensor.djh.attributes["powerAbsTot"] * 1000 * 3 / 10154) | round(1) }}'
      unit_of_measurement: "W"
    djh_wind_direction:
      friendly_name: 'Wind Richting'
      value_template: '{{ states.sensor.djh.attributes["windDirection"] }}'
2 Likes

And the energy generated today (Wh)

relevant part out of sensors.yaml

- platform: command_line
  name: djh_today
  command: curl --silent https://zep-api.windcentrale.nl/production/2 | grep period=\"DAY\" | awk -F"sum=" '/sum=/{print $2}' | sed -e 's/^"//' -e 's/">$//'

- platform: template
  sensors:
    djh_myday:
      friendly_name: 'Wind energy vandaag'
      value_template: '{{ ((states.sensor.djh_today.state) | float * 1000 * 3 / 10541) | round(0) }}'
      unit_of_measurement: "Wh"

If someone finds a more elegant way of getting the data instead of using ‘curl | grep | awk | sed’ I would love to know :slight_smile: anyway, it works (for now).

I would like to add the statistics to this sensor template, the statistics that came with the 2021.8 release (a few days ago when I am writing this). Anyone found out how to do this? I will try to find out, but if anyone knows, I would love to hear it how to add it.

[edit1]According to the docs I need to add “state_class: measurement”. However I get an error that state_class is an invalid option for sensor.template

[edit2] Found it, state_class needs to be inside attribute_templates. See example below.

- platform: template
  sensors:
    djh_mypower:
      friendly_name: 'Wind Power'
      value_template: '{{ (states.sensor.djh.attributes["powerAbsTot"] * 1000 * 3 / 10154) | round(1) }}'
      unit_of_measurement: "W"
      device_class: power
      attribute_templates:
        state_class: 'measurement'

I think you need to wait one hour or so before you see any statistics, so be patient.

1 Like

Testing as we speak ;). Now the question is, where do you add the Wind power? Return to Grid or together with the Solar?

Btw, I added the state_class, but it doesn’t show at the Energy options. and yes, I waited long enough. Did you manage it?

yes, it is working. I think the next day the statistics were available.

Thanks for responding. Unfortunately I cant’t seem to get it to work. If I am correct, if configured correctly the item should directly be availiable as entity, you “only” have to wait for the statistics itself. However, whatever I try, I don’t see them as entity for the energy panel. Am I missing something?

   - platform: template
     sensors:
      djh_mypower:
        friendly_name: 'Wind Power'
        value_template: '{{ (states.sensor.djh.attributes["powerAbsTot"] * 1000 * 5 / 10154) | round(1) }}'
        unit_of_measurement: "W"
        device_class: power
        attribute_templates:
         state_class: 'measurement'

did you reload or restart HA?

I did many times :wink:

I finally managed by adding the following code into configuration.yaml:

utility_meter:
daily_winddelen:
source: sensor.djh_myday
cycle: daily

I released a custom_component for windcentrale with UI setup

4 Likes

Hi Job,

Thank you for your good work. I’ve been trying to get the integration working for a while, but I’m running into 2 things.

  • in the configuration screen (where you enter your login details) it says that you can specify the number of wind parts. However, I don’t see the option to do that anywhere? Or does it automatically take over when you log in?
  • I would like to add the energy to my energy dashboard as supplied energy. However, I think I miss the sensor day compensation (sensor.de_bonte_hen_energy_compensation).

Am I overlooking something? Hope you can help me. Regards

1 Like

Hi @Ralfkroon,

  • From version 0.2.X onwards the shares should be automatically.
  • Indeed same, that sensor no longer exists. You now have the sensor sensor.name_energy_shares.

The documentation just hasn’t been updated. I have been very busy lately, but I will update it tonight so if you look tomorrow it will be uptodate.

With kind regards,

Jobvk

1 Like

Great! Thanks. It’s working!

Thanks, this is working great.