Doese anyone intigrated Fenecon Home into Home Assistant?

Hi, I bought a PV solution with Battery from Fenecon: https://fenecon.de/fenecon-home/

Actuall I don’t found a ready Implementation for it, but they allowing to conntect via API/Rest.
https://docs.fenecon.de/de/_/latest/fems/apis.html

Would really presuade if sombody can give me a hint.

Thanks Michael

3 Likes

If I try that:
[http://x:[email protected]:80/rest]

I get that Output:

{“jsonrpc”:“2.0”,“id”:“00000000-0000-0000-0000-000000000000”,“error”:{“code”:1003,“message”:“Authentication failed”,“data”:[]}}

I am considering to purchase a Fenecon home (instead of Tesla Powerwall) system and would also like to know if anyone has integrated it to HA.

### Fenecon Home ###
  - platform: rest
    resource: http://192.168.xx.xx:8084/rest/channel/_sum/GridBuyActiveEnergy
    authentication: basic
    username: "user"
    password: "user"
    name: FEMS Test
    value_template: '{{ value_json["value"] | float * 0.001}}'
    unit_of_measurement: "kWh"
    scan_interval: 120

https://docs.fenecon.de/de/_/latest/fems/apis.html#_channel_endpunkt

2 Likes

I have successfully integrated by using the Modbus API, which seems to work quite well.

I think that modbus is better than REST, because the data is transferred in binary, which should be a lot more efficient than getting every single value with JSON…

You should adjust the IP-Address, the Names and the Update/Scan intervals to your needs.

You can also download the protocol table for your specific Installation in your “Anlagenprofil”.

Also the list is not complete, and I do not know what some registers actually do, and some might be labeled incorrectly, so check if the data matches with the FEMS Online Portal first, before using it.

https://docs.fenecon.de/de/_/latest/fems/fems-app/includes/FEMS_App_Modbus_TCP.html

- name: "fems"
  close_comm_on_error: false
  delay: 5
  timeout: 5
  type: tcp
  host: 192.168.xx.xx
  port: 502
  
  sensors:
    #INT
    - name: "FEMS_EssSoc" # Battery SoC
      scan_interval: 60 
      data_type: uint16
      input_type: input
      device_class: battery
      state_class: measurement
      unit_of_measurement: "%"
      address: 302
      slave: 1
      unique_id: fems_modbus_302

    #FLOAT32      
    - name: "FEMS_EssActivePower" # Combined Power of PV + Battery
      unit_of_measurement: W
      scan_interval: 10
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 303
      slave: 1
      unique_id: fems_modbus_303

    - name: "FEMS_GridActivePower" # Grid Power
      unit_of_measurement: W
      scan_interval: 10 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 315
      slave: 1
      unique_id: fems_modbus_315

    - name: "FEMS_ProductionDcActualPower" # PV Power
      unit_of_measurement: W
      scan_interval: 10
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 339
      slave: 1
      unique_id: fems_modbus_339
      
    - name: "FEMS_ConsumptionActivePower" #House Power
      unit_of_measurement: W
      scan_interval: 10
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 343
      slave: 1
      unique_id: fems_modbus_343
      
    - name: "FEMS_EssActivePowerL1"
      unit_of_measurement: W
      scan_interval: 20 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 391
      slave: 1
      unique_id: fems_modbus_391
      
    - name: "FEMS_EssActivePowerL2"
      unit_of_measurement: W
      scan_interval: 20 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 393
      slave: 1
      unique_id: fems_modbus_393
      
    - name: "FEMS_EssActivePowerL3"
      unit_of_measurement: W
      scan_interval: 20 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 395
      slave: 1
      unique_id: fems_modbus_395
      
    - name: "FEMS_GridActivePowerL1"
      unit_of_measurement: W
      scan_interval: 20 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 397
      slave: 1
      unique_id: fems_modbus_397
      
    - name: "FEMS_GridActivePowerL2"
      unit_of_measurement: W
      scan_interval: 20 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 399
      slave: 1
      unique_id: fems_modbus_399
      
    - name: "FEMS_GridActivePowerL3"
      unit_of_measurement: W
      scan_interval: 20 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 401
      slave: 1
      unique_id: fems_modbus_401
      
    - name: "FEMS_ConsumptionActivePowerL1"
      unit_of_measurement: W
      scan_interval: 20 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 409
      slave: 1
      unique_id: fems_modbus_409
      
    - name: "FEMS_ConsumptionActivePowerL2"
      unit_of_measurement: W
      scan_interval: 20 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 411
      slave: 1
      unique_id: fems_modbus_411
      
    - name: "FEMS_ConsumptionActivePowerL3"
      unit_of_measurement: W
      scan_interval: 20 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 413
      slave: 1
      unique_id: fems_modbus_413
            
    - name: "FEMS_EssDischargePower"  #Battery Discharge Power
      unit_of_measurement: W
      scan_interval: 5 
      data_type: float32
      input_type: holding
      device_class: power
      state_class: measurement
      address: 415
      slave: 1
      unique_id: fems_modbus_415
      
      
      
      
      
    #Energy  (Float64)
      
    - name: "FEMS_EssActiveChargeEnergy" #not sure what this is, I think its the Energy the battery has been charged form AC/the Grid, should not be too high, because its normally not possible/allowed (in Germany at least) to charge from the Grid.
      unit_of_measurement: Wh
      scan_interval: 60 
      data_type: float64
      input_type: holding
      device_class: energy
      state_class: total_increasing
      address: 351
      slave: 1
      unique_id: fems_modbus_351
      
    - name: "FEMS_EssActiveDischargeEnergy" #not sure what this is, I think its the total amount of Energy the System has put out to AC, so basicially the the amount of PV minus what is currently stored in the battery plus the amount that you have charged from the Grid (so FEMS_EssActiveChargeEnergy), but that is normally not possible, so this is not very useful.
      unit_of_measurement: Wh
      scan_interval: 60 
      data_type: float64
      input_type: holding
      device_class: energy
      state_class: total_increasing
      address: 355
      slave: 1
      unique_id: fems_modbus_355
      
    - name: "FEMS_GridBuyActiveEnergy" #Total Consumption from Grid
      unit_of_measurement: Wh
      scan_interval: 60 
      data_type: float64
      input_type: holding
      device_class: energy
      state_class: total_increasing
      address: 359
      slave: 1
      unique_id: fems_modbus_359 
      
    - name: "FEMS_GridSellActiveEnergy" #Total Energy Sold to Grid
      unit_of_measurement: Wh
      scan_interval: 60 
      data_type: float64
      input_type: holding
      device_class: energy
      state_class: total_increasing
      address: 363
      slave: 1
      unique_id: fems_modbus_363

    - name: "FEMS_ProductionActiveEnergy" # Total PV Production Energy
      unit_of_measurement: Wh
      scan_interval: 60 
      data_type: float64
      input_type: holding
      device_class: energy
      state_class: total_increasing
      address: 367
      slave: 1
      unique_id: fems_modbus_367
      
    - name: "FEMS_ConsumptionActiveEnergy" # Total Energy Usage
      unit_of_measurement: Wh
      scan_interval: 60 
      data_type: float64
      input_type: holding
      device_class: energy
      state_class: total_increasing
      address: 379
      slave: 1
      unique_id: fems_modbus_379
      
    - name: "FEMS_EssDcChargeEnergy" # Total Battery Charge Energy
      unit_of_measurement: Wh
      scan_interval: 60 
      data_type: float64
      input_type: holding
      device_class: energy
      state_class: total_increasing
      address: 383
      slave: 1
      unique_id: fems_modbus_383
      
    - name: "FEMS_EssDcDischargeEnergy" # Total Battery Discharge Energy
      unit_of_measurement: Wh
      scan_interval: 60 
      data_type: float64
      input_type: holding
      device_class: energy
      state_class: total_increasing
      address: 387
      slave: 1
      unique_id: fems_modbus_387

To integrate it follow these instructions: (by @Skeletitor)

  1. ssh to /config/ and add to configuration.yaml or use the File Editor Addon
modbus: !include modbus.yaml
  1. create a file modbus.yaml (in the same directory as configuration.yaml and paste the upper code for the rest integration. Attention! Adjust the IP of your Fenecon installation. Also you should adjust the channels and the names to those that are interesting to you.
  2. restart Home Assistant
3 Likes

Well done!

1 Like

I’m trying to include fenecon into home assistant too. Could you report your steps how you successfully added it ?
Bests
Andreas

1 Like
  1. ssh to /config/ and add to configuration.yaml
modbus: !include modbus.yaml
  1. create a file ‘modbus.yaml’ (in the same directory as configuration.yaml’ and past the upper code. Attention! Adjust the IP of your Fenecon installation.
  2. restart hassio

//edit: I guess this code works for default installations with a default system profile. Depending on the installation and apps, the system profile may change.

3 Likes

@benniju - Did you figure out if we can get access to the power states of both chargers via Modbus? I’m blind or these metrics aren’t there.

Oh sorry for not answering for so long. I thought the forum would send E-Mails (I set the thread to watching).

No I have not yet figured out how/if you can get those values via Modbus. For those values I use the REST API. (And I am not sure if the endpoints other than the _sum/ channels are officially supported, but it works fine)

You can find out which API-Endpoints exist by either looking at the Websocket Connection in the Browser Dev Tools (FEMS) or by sending requests like the following one in the Talend API Tester (The setup of that is described by Fenecon here):

http://<YOUR IP HERE>:8084/rest/channel/charger.+/.+

This gets every value from every charger (PV-String) (for example the voltages or production values), it works because the REST API apparently supports some kind of Regex. (Thanks for openWB, I saw that trick in their source code, you could also look at the openEMS-Source-Code)

The first part after the channel is the same as in the “Anlagenprofil”:

I have to use the selectattr("address", "equalto", "battery0/Tower0PackVoltage") | map(attribute="value") | first filter because the order of the response is kind of random, so you should not use a simple [2] for example.
(Please let me know if there is a better way to do that.)

Alternatively you could send responses for every value, but I do not like that approach as that would send to many HTTP-Requests for my taste. (AFAIK there is basically just a poor Raspberry Pi running the FEMS-Box.)

This is my current REST-Configuration (for example for getting the temperatures):
(You need to replace the IP for every URL)

- resource: "http://<YOUR IP HERE>:8084/rest/channel/battery0/(Tower0PackVoltage|Current|Soh)"
  username: x
  password: user
  authentication: basic
  scan_interval: 60
  sensor:
    - value_template: '{{value_json | selectattr("address", "equalto", "battery0/Tower0PackVoltage") | map(attribute="value") | first / 10 }}'
      name: "FEMS Batteriespannung"
      unit_of_measurement: "V"
      device_class: voltage
      state_class: measurement
      unique_id: "fems/battery0/Tower0PackVoltage"
    - value_template: '{{value_json | selectattr("address", "equalto", "battery0/Current") | map(attribute="value") | first }}'
      name: "FEMS Batteriestrom"
      unit_of_measurement: "A"
      device_class: current
      state_class: measurement
      unique_id: "fems/battery0/Current"
    - value_template: '{{value_json | selectattr("address", "equalto", "battery0/Soh") | map(attribute="value") | first }}'
      name: "FEMS Batterie State of Health"
      unit_of_measurement: "%"
      #device_class: current
      state_class: measurement
      unique_id: "fems/battery0/Soh"

- resource: "http://<YOUR IP HERE>:8084/rest/channel/charger.+/(ActualPower|Voltage|Current|ActualEnergy)"
  username: x
  password: user
  authentication: basic
  scan_interval: 20
  sensor:
    - name: "FEMS PV 2 Leistung"
      value_template: '{{value_json | selectattr("address", "equalto", "charger1/ActualPower") | map(attribute="value") | first }}'
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      unique_id: "fems/charger1/ActualPower"
    - value_template: '{{value_json | selectattr("address", "equalto", "charger1/Voltage") | map(attribute="value") | first / 1000 }}'
      name: "FEMS PV 2 Spannung"
      unit_of_measurement: "V"
      device_class: voltage
      state_class: measurement
      unique_id: "fems/charger1/Voltage"
    - value_template: '{{value_json | selectattr("address", "equalto", "charger1/Current") | map(attribute="value") | first / 1000 }}'
      name: "FEMS PV 2 Strom"
      unit_of_measurement: "A"
      device_class: current
      state_class: measurement
      unique_id: "fems/charger1/Current"
    - value_template: '{{value_json | selectattr("address", "equalto", "charger1/ActualEnergy") | map(attribute="value") | first }}'
      name: "FEMS PV 2 Erzeugung"
      unit_of_measurement: "Wh"
      device_class: energy
      state_class: total_increasing
      unique_id: "fems/charger1/ActualEnergy"


    - value_template: '{{value_json | selectattr("address", "equalto", "charger0/ActualPower") | map(attribute="value") | first }}'
      name: "FEMS PV 1 Leistung"
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      unique_id: "fems/charger0/ActualPower"
    - value_template: '{{value_json | selectattr("address", "equalto", "charger0/Voltage") | map(attribute="value") | first / 1000 }}'
      name: "FEMS PV 1 Spannung"
      unit_of_measurement: "V"
      device_class: voltage
      state_class: measurement
      unique_id: "fems/charger0/Voltage"
    - value_template: '{{value_json | selectattr("address", "equalto", "charger0/Current") | map(attribute="value") | first / 1000 }}'
      name: "FEMS PV 1 Strom"
      unit_of_measurement: "A"
      device_class: current
      state_class: measurement
      unique_id: "fems/charger0/Current"
    - value_template: '{{value_json | selectattr("address", "equalto", "charger0/ActualEnergy") | map(attribute="value") | first }}'
      name: "FEMS PV 1 Erzeugung"
      unit_of_measurement: "Wh"
      device_class: energy
      state_class: total_increasing
      unique_id: "fems/charger0/ActualEnergy"


- resource: "http://<YOUR IP HERE>:8084/rest/channel/batteryInverter0/(AirTemperature|BmsPackTemperature|RadiatorTemperature)"
  username: x
  password: user
  authentication: basic
  scan_interval: 60
  sensor:    
    - value_template: '{{value_json | selectattr("address", "equalto", "batteryInverter0/AirTemperature") | map(attribute="value") | first }}'
      name: "FEMS batteryInverter0/AirTemperature"
      unit_of_measurement: "°C"
      device_class: temperature
      state_class: measurement
      unique_id: "fems/batteryInverter0/AirTemperature"
    - value_template: '{{value_json | selectattr("address", "equalto", "batteryInverter0/BmsPackTemperature") | map(attribute="value") | first }}'
      name: "FEMS batteryInverter0/BmsPackTemperature"
      unit_of_measurement: "°C"
      device_class: temperature
      state_class: measurement
      unique_id: "fems/batteryInverter0/BmsPackTemperature"
    - value_template: '{{value_json | selectattr("address", "equalto", "batteryInverter0/RadiatorTemperature") | map(attribute="value") | first }}'
      name: "FEMS batteryInverter0/RadiatorTemperature"
      unit_of_measurement: "°C"
      device_class: temperature
      state_class: measurement
      unique_id: "fems/batteryInverter0/RadiatorTemperature"
      

To integrate it: (thanks to @Skeletitor for the clear instructions)

  1. ssh to /config/ and add to configuration.yaml or use the File Editor Addon
rest: !include rest_integration.yaml
  1. create a file rest_integration.yaml (in the same directory as configuration.yaml and paste the upper code for the rest integration. Attention! Adjust the IP of your Fenecon installation in the multiple places. Also you should adjust the channels to those that are interesting to you.
  2. restart Home Assistant

Another possibilty would be to use the Websocket API on Port 8085, which is unfortunately not yet documented neither by FENECON nor openEMS. I have used the Simple WebSocket Client Extension for Chrome to experiment with the Websocket-API.

It seems to be quite simple JSON-RPC. I “reverse-engineered” it by looking at the Websocket in Firefox, where you can see the whole communication, for example how it subscribes to more channels when you open, for example the consumption card, to subscribe to each phases power value.

Click here to show the requests and responses for the Websocket API (to not use up that much space in the thread)
  1. You just need to send one request to authenticate:
{
   "jsonrpc":"2.0",
   "method":"authenticateWithPassword",
   "params":{
      "password":"user"
   },
   "id":"60e8f988-9435-4c18-9421-080dcc18b459"
}

This respones with a token which you could also use to authenticate.

{"jsonrpc":"2.0","method":"authenticateWithToken","params":{"token":"token here"},"id":"9cd785f7-121f-4576-b310-ff77bd7aad45"}
  1. Then you can subscribe to the channels
{
   "jsonrpc":"2.0",
   "method":"edgeRpc",
   "params":{
      "edgeId":"0",
      "payload":{
         "jsonrpc":"2.0",
         "method":"subscribeChannels",
         "params":{
            "count":"0",
            "channels":[
               "_sum/State",
               "_sum/EssSoc",
               "battery0/Tower0PackVoltage"
            ]
         },
         "id":"1bfd9015-eda9-4576-a7d5-4d777f505f1d"
      }
   },
   "id":"d3bf4200-7fc9-4c85-8656-59cc3facd253"
}

After that a response with the values is send every second (I don’t know if there is a way to change the timing, though someone could look at the openEMS-Websocket-Source-Code):

{
   "jsonrpc":"2.0",
   "method":"edgeRpc",
   "params":{
      "edgeId":"0",
      "payload":{
         "jsonrpc":"2.0",
         "method":"currentData",
         "params":{
            "_sum/EssSoc":48,
            "_sum/State":0,
            "battery0/Tower0PackVoltage":2780
         }
      }
   }
}

It would be great if someone could write an integration (or something similar to zigbee2mqtt, called for example openems2mqtt) to use this Websocket-API in Home-Assistant, I currently do not have the time and experience for creating something like that.

1 Like

Hello Benjamin,

since two days I have a Fenecon Home running. And now I want to implement the values shown at the FEMS board in my home assistant. So far I’ve only worked with prepared integrations - now I’m trying to work on source codes.

It is important to me that I get the values ​​comparable to those of the FEMS board in the HA. I could find some in your modbus script. Thanks to your great instructions - I got that to work for me.

With the REST script I am missing the installation point here. Where and how do you have to integrate this to get it working. Would you be so kind as to explain this to me? Thanks very much!

Best Thomas

Hmm,
I’m not sure if an integration should use an API which is not official supported.
But good work. Thanks for that. This websockets may be used by their own IU.

But I’ve found some infos about an MQTT implementation in openEMS: openems/io.openems.edge.controller.api.mqtt at develop · OpenEMS/openems · GitHub

I’m not sure if this can be used in FEMS now. → Sounds like a feature request

//BTW - yep I didn’t get your answer too. I guess we need to subscribe to a topic here.

You can install it just like the modbus installation (as @Skeletitor described here) so basically:

  1. ssh to /config/ and add to configuration.yaml or use the File Editor Addon
rest: !include rest_integration.yaml
  1. create a file rest_integration.yaml (in the same directory as configuration.yaml and paste the upper code for the rest integration. Attention! Adjust the IP of your Fenecon installation in the multiple places. Also you should adjust the channels to those that are interesting to you.
  2. restart Home Assistant

Well the Websocket API is listed by Fenecon here, so it is theoretically supported, but it is not yet officially documented (the page says that it’s TODO).

I asked the Fenecon Support about the MQTT-API that is available on openEMS, and they said that it is not available for FEMS (at least for now). There are also no open ports on the device which would point to mqtt.

This is a nmap scan:

PORT     STATE SERVICE
22/tcp   open   ssh
80/tcp   open   http
1883/tcp closed mqtt     # mqtt port is closed
8084/tcp open   unknown  # That is the port for the REST-API
8085/tcp open   unknown  # That is the port for the Websocket-API

They just have to publish the configuration, e.g. in ‘plant profile/system profile/Anlagenprofil (don’t know how to translate this)’ or an app and give us the possibility to configure the MQTT broker setting. This shouldn’t be rocket science.

1 Like

On this German Article the Head of Energy Management Systems at FENECON GmbH (Stefan Feilmeier) commented the following:

Hallo Bernhard,

es ist immer wichtig zu unterscheiden zwischen dem Open-Source Projekt OpenEMS und dem von FENECON als Produkt unterstützten FEMS. Für FEMS gibt es zwar grundsätzlich eine Kompatibilität mit MQTT (siehe openems/io.openems.edge.controller.api.mqtt at develop · OpenEMS/openems · GitHub), aber noch keine fertige „FEMS-App“ (inkl. Inbetriebnahmeunterstützung, Service, etc.)

Kontaktiere mich doch bitte einmal per PN über das Community Forum: Profile - stefan.feilmeier - OpenEMS Community

Gruß,
Stefan

So maybe someone could try contacting him about that?

1 Like

Hallo Benjamin,

Thank you for information! Now I can read and implement the values from string1+2 - great work!

I am currently waiting for the integration of Fenecon for my Kostal - then I will try to get the power values from him.

One Question: Due to my programming I found some interesting topics that I have to check (selling of energy to the grid at night from battery and buying of energy at day while the sun is shinig and the battery is loading). Could this be a programming mistake from my side?

Grüße
Thomas

Hi all,
I just got a Fenecon Home so here are some hints for the REST API.
Maybe this can help someone, …for me it was the first time using Rest with HA so maybe not the perfect solution but it’s working

Home Assistant does automatically support rest, so nothing else is required:
I added this lines into configuration.yaml

The template part is to enable the values for the energy pane and to show the units:

sensor:
- platform: rest  
  name: "rest_fenecon_state"
  resource: http://gast:[email protected]:80/rest/channel/_sum/State
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_ess_soc"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/EssSoc
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_ess_active_power"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/EssActivePower
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_grid_active_power"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/GridActivePower
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_production_active_power"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ProductionActivePower
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_production_ac_active_power"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ProductionAcActivePower
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_production_dc_actual_power"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ProductionDcActualPower
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_consumption_active_power"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ConsumptionActivePower
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_ess_active_charge_energy"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/EssActiveChargeEnergy
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_ess_active_discharge_energy"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/EssActiveDischargeEnergy
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_grid_buy_active_energy"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/GridBuyActiveEnergy
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_grid_sell_active_energy"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/GridSellActiveEnergy
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_production_active_energy"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ProductionActiveEnergy
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_production_ac_active_energy"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ProductionAcActiveEnergy
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_production_dc_active_energy"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ProductionDcActiveEnergy
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_consumption_active_energy"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ConsumptionActiveEnergy
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_ess_active_power_l1"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/EssActivePowerL1
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_ess_active_power_l2"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/EssActivePowerL2
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_ess_active_power_l3"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/EssActivePowerL3
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_grid_active_power_l1"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/GridActivePowerL1
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_grid_active_power_l2"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/GridActivePowerL2
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_grid_active_power_l3"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/GridActivePowerL3
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_production_ac_active_power_l1"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ProductionAcActivePowerL1
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_production_ac_active_power_l2"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ProductionAcActivePowerL2
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_production_ac_active_power_l3"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ProductionAcActivePowerL3
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_consumption_active_power_l1"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ConsumptionActivePowerL1
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_consumption_active_power_l2"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ConsumptionActivePowerL2
  value_template: "{{ value_json.value }}"
- platform: rest  
  name: "rest_fenecon_consumption_active_power_l3"
  scan_interval: 30  
  resource: http://gast:[email protected]:80/rest/channel/_sum/ConsumptionActivePowerL3
  value_template: "{{ value_json.value }}"


template:
  - sensor:
      - name: "fenecon_ess_soc"
        device_class: battery
        unit_of_measurement: '%'
        state_class: measurement
        state: "{{ states('sensor.rest_fenecon_ess_soc')| int }}"
      - name: "fenecon_ess_active_power"
        unit_of_measurement: W
        device_class: energy
        state_class: measurement
        state: "{{ states('sensor.rest_fenecon_ess_active_power')| int }}"
      - name: "fenecon_grid_active_power"
        unit_of_measurement: W
        device_class: energy
        state_class: measurement
        state: "{{ states('sensor.rest_fenecon_grid_active_power')| int }}"
      - name: "fenecon_production_active_power"
        unit_of_measurement: W
        device_class: energy
        state_class: measurement
        state: "{{ states('sensor.rest_fenecon_production_active_power')| int }}"
      - name: "fenecon_consumption_active_power"
        unit_of_measurement: W
        device_class: energy
        state_class: measurement
        state: "{{ states('sensor.rest_fenecon_consumption_active_power')| int }}"
      - name: "fenecon_ess_active_charge_energy"  
        unit_of_measurement: Wh
        device_class: energy
        state_class: total_increasing
        state: "{{ states('sensor.rest_fenecon_ess_active_charge_energy')| int }}"
      - name: "fenecon_ess_active_discharge_energy"
        unit_of_measurement: Wh
        device_class: energy
        state_class: total_increasing
        state: "{{ states('sensor.rest_fenecon_ess_active_discharge_energy')| int }}"
      - name: "fenecon_grid_buy_active_energy"
        unit_of_measurement: Wh
        device_class: energy
        state_class: total_increasing
        state: "{{ states('sensor.rest_fenecon_grid_buy_active_energy')| int }}"
      - name: "fenecon_grid_sell_active_energy"
        unit_of_measurement: Wh
        device_class: energy
        state_class: total_increasing
        state: "{{ states('sensor.rest_fenecon_grid_sell_active_energy')| int }}"
      - name: "fenecon_production_active_energy"
        unit_of_measurement: Wh
        device_class: energy
        state_class: total_increasing
        state: "{{ states('sensor.rest_fenecon_production_active_energy')| int }}"
      - name: "fenecon_consumption_active_energy"
        unit_of_measurement: Wh
        device_class: energy
        state_class: total_increasing
        state: "{{ states('sensor.rest_fenecon_consumption_active_energy')| int }}"

##############
I have added a separate Fenecon page:

every hint to improve is welcome :wink:

2 Likes

Hey Juergen,
great Job, thank you very much, it works very good.

THX Michael