MQTT Attributes and Cards

How can I attach the mqtt attributes to
the card with the graph?

If I transfer the data as a REST service, then these are added
automatically.

In the MQTT transmission not?

What error do I make in the sensor definition:

#########################################################
## all for kostal solar power device
##
## datasource mqtt
## {  
##   "state" : "Einspeisen",
##   "Timestamp" : "2017-07-15 16:00:04",
##   "daykw" : 16.07,
##   "name" : "Kostal Wechselrichter",
##   "attributes" : {
##     "Modus" : "Einspeisen",
##     "Current_Power_watt" : 2152,
##     "Total_Power_kwh" : 16433,
##     "Day_Power_kwh" : 16.07,
##     "Pulsmeter_S1_volt" : 486,
##     "Output_L1_volt" : 228,
##     "Pulsmeter_S1-ampere" : 1.52,
##     "Output_L1_watt" : 721,
##     "Pulsmeter_S2_volt" : 218,
##     "Output_L2_volt" : 230,
##     "Pulsmeter_S2_ampere" : 7.12,
##     "Output_L2_watt" : 731,
##     "Pulsmeter_S3_volt" : 0,
##     "Output_L3_volt" : 226,
##     "Pulsmeter_S3_ampere" : 0,
##     "Output_L3_watt" : 700
##   }
## }
#########################################################

#########################################################
### all from the mqtt service
#########################################################
- platform: mqtt
  name: "Kostal"
  state_topic: "tele/kostaldata"
  unit_of_measurement: "kWh"
  value_template: "{{ value_json.daykw }}"
  
- platform: mqtt
  name: "Kostal Time"
  state_topic: "tele/kostaldata"
  value_template: "{{ value_json.Timestamp }}" 

Card sample MQTT vs. REST Service

MQTT and REST same data.
MQTT do not add attributes
REST do add attributes.

tele/kostaldata: 
  {"attributes":
      {"Modus":"Einspeisen",
	   "Current_Power_watt":2152,
	   "Total_Power_kwh":16433,
	   "Day_Power_kwh":16.07,
	   "Pulsmeter_S1_volt":486,
	   "Output_L1_volt":228,
	   "Pulsmeter_S1-ampere":1.52,
	   "Output_L1_watt":721,
	   "Pulsmeter_S2_volt":218,
	   "Output_L2_volt":230,
	   "Pulsmeter_S2_ampere":7.12,
	   "Output_L2_watt":731,
	   "Pulsmeter_S3_volt":0,
	   "Output_L3_volt":226,
	   "Pulsmeter_S3_ampere":0,
	   "Output_L3_watt":700,
	   "Timestamp":"2017-07-15 16:00:04"
	   },
	 "state":"Einspeisen",
	 "Timestamp":"2017-07-15 16:00:04",
	 "daykw":16.07,
	 "name":"Kostal Wechselrichter"
}

@petsie
How do you get your data out of your inverter?

I use a node js script (run as cronjob) on the raspberry.

/* ------------------------------------------------------
 * SMARTHOME KOSTAL DATA 
 *
 * Node Plugins install:
 *   npm install mqtt --save
 *   npm install request --save
 *   npm install xpath --save
 *   npm install xmldom --save
 *   npm install cron --save  [optional, not for nix]
 * 
 * crontab call: 8 * * * * /usr/local/bin/node /var/www/homedata/mqtt_kostal.js.js >/dev/null 2>&1
 * 
 * @call:        node mqtt_kostaldata.js
 * 
 * ---------------------------------------------------------- */

var moment = require('moment'),
    request = require('request'),
    mqtt = require('mqtt'),
    xpath = require('xpath'),
    dom = require('xmldom').DOMParser,
    dpOptions = {
        locator: {},
        errorHandler: {
            // disable all warnings
            warning: function(w) {},
            //error:cb,
            //fatalError:cb
        }
    },
    settings = {
        url: "http://pvserver:(PASSWORD)@(IPADRESS)",    // the pvserver password and ip address
        strModeOff: 'Keine Daten',
        strModeON: 'Einspeisen',
        strMPPState: 'Einspeisen MPP'
    },
    client = null,
    mqttHost = "mqtt://(MQTTBROKER HOST)",              // the mqtt host
    options = {
        port: 1883,
        username: "(USERNAME)",                          // username for mqtt brocker
        password: "(PASSWORD)"                           // password for mqtt brocker
    };

/**
 * get kostal data
 * 
 * simply get the kostal piko data from
 * the http request.
 */
function getKostalData() {
    // get the html page from the kostal pico device
    request({
        url: settings.url,
        headers: {
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
            'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4'
        }
    }, function(error, response, body) {
        if (response && response.statusCode == 200) {
            // valid html data, parse the body elements
            var doc = new dom(dpOptions).parseFromString(body),
                nodes = xpath.select("//td[@bgcolor='#FFFFFF']", doc),
                names = ['Current_Power_watt', 'Total_Power_kwh', 'Day_Power_kwh',
                    'Pulsmeter_S1_volt', 'Output_L1_volt',
                    'Pulsmeter_S1-ampere', 'Output_L1_watt',
                    'Pulsmeter_S2_volt', 'Output_L2_volt',
                    'Pulsmeter_S2_ampere', 'Output_L2_watt',
                    'Pulsmeter_S3_volt', 'Output_L3_volt',
                    'Pulsmeter_S3_ampere', 'Output_L3_watt'
                ],
                n = 0,
                data = {},
                v = 0.00;
            data.attributes = {};
            // check the node length
            if (nodes.length === names.length) {
                // valid node length
                if (body.search(settings.strMPPState) != -1) {
                    data.attributes['Modus'] = settings.strModeON;
                } else {
                    data.attributes['Modus'] = settings.strModeOff;
                }
                // interate throw all node elements
                nodes.forEach(function(e) {
                    v = (isNaN(parseFloat(e.firstChild.data.trim()))) ? 0.00 : e.firstChild.data.trim();
                    data.attributes[names[n]] = parseFloat(v);
                    n++; // next item
                });
                data.attributes['Timestamp'] = moment().format("YYYY-MM-DD HH:mm:ss");
                if (n) {
                    data['state'] = data.attributes['Modus'];
                    data['Timestamp'] = data.attributes['Timestamp'];
                    data['daykw'] = data.attributes['Day_Power_kwh'];
                    data['name'] = 'Kostal Wechselrichter';
                    client = mqtt.connect(mqttHost, options);
                    console.log('tele/kostaldata', JSON.stringify(data));
                    client.publish('tele/kostaldata', JSON.stringify(data));
                    client.end();
                    return n;
                }
            } else {
                console.log('Webservice kostal piko no payload found, check the webservice');
            }
            return false;

        } else {
            console.log('--------  FATAL ERROR KOSTAL PIKO WEBSERVICE ----------');
            console.log(response.statusCode);
            console.log(error);
            console.log('--------  FATAL ERROR KOSTAL PIKO WEBSERVICE ----------');
        }
    });
}

// main
if (getKostalData() == false) {
    console.log("Kostal Pico service failed!")
} else {
    console.log("Kostal Pico service all well done.")
}

thanks, I’m going to try this…

@ gieljnssns

Or you can use node-red

FLOW for KOSTAL PIKO


[{"id":"6421893c.968b4","type":"tab","label":"Kostal Piko","disabled":false,"info":"All data from the kostal piko device and all\ns0 sensors..."},{"id":"5a855f4f.2a0728","type":"inject","z":"6421893c.968b4","name":"Timer for data","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":true,"onceDelay":"","x":120,"y":180,"wires":[["ab2edc17.89f03","132be680.13c062","78980e1e.2ee6b8"]]},{"id":"efd3d962.139b08","type":"html","z":"6421893c.968b4","name":"Watt aktuell","tag":"body > form > font > table:nth-child(2) > tr:nth-child(4) > td:nth-child(3)","ret":"text","as":"multi","x":550,"y":640,"wires":[["559eb16b.9b761"]],"outputLabels":["watt"]},{"id":"ab2edc17.89f03","type":"http request","z":"6421893c.968b4","name":"Request: SET PASSWORD && IPADDRESS","method":"GET","ret":"txt","url":"http://pvserver:PASSWORD@IPADDRESS","tls":"","x":270,"y":480,"wires":[["efd3d962.139b08","ca195eeb.84edf8","7a9012cc.1145dc"]]},{"id":"ca195eeb.84edf8","type":"html","z":"6421893c.968b4","name":"Tag kWh","tag":"body > form > font > table:nth-child(2) > tr:nth-child(6) > td:nth-child(6)","ret":"text","as":"multi","x":540,"y":360,"wires":[["559eb16b.9b761"]],"outputLabels":["daykwh"]},{"id":"7a9012cc.1145dc","type":"html","z":"6421893c.968b4","name":"Gesamtenergie kWh","tag":"body > form > font > table:nth-child(2) > tr:nth-child(4) > td:nth-child(6)","ret":"text","as":"multi","x":580,"y":740,"wires":[["559eb16b.9b761"]],"outputLabels":["kwh"]},{"id":"559eb16b.9b761","type":"join","z":"6421893c.968b4","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"3","x":630,"y":500,"wires":[["938d9079.2d79d8","24fdee5.816a012","6b2b7b1e.c37b64","ef8307b2.91ce1","40c9d85a.9f19f8"]]},{"id":"40c9d85a.9f19f8","type":"debug","z":"6421893c.968b4","name":"","active":false,"console":"false","complete":"payload.watt","x":830,"y":320,"wires":[]},{"id":"938d9079.2d79d8","type":"function","z":"6421893c.968b4","name":"build payload","func":"var payload = msg.payload,\n    o = {};\n    o.device   = \"Kostal PIKO 5.5 \";\n    o.time     = new Date().toLocaleString();\n    o.watt     = 0.00;\n    o.daykwh   = 0.00;\n    o.totalkwh = 0.00;\n// build the payload for the mqtt broker\nif(payload && payload.length) {\n   o.watt      = parseFloat(payload[0].replace(/\\r?\\n?/g, '').trim())||0.00;\n   o.daykwh    = parseFloat(payload[1].replace(/\\r?\\n?/g, '').trim())||0.00;\n   o.totalkwh  = parseFloat(payload[2].replace(/\\r?\\n?/g, '').trim())||0.00;\n   return {payload: o};\n} else {\n    return {payload: o};\n}","outputs":1,"noerr":0,"x":808.5,"y":449,"wires":[["c670457c.c1fdb8"]]},{"id":"c670457c.c1fdb8","type":"mqtt out","z":"6421893c.968b4","name":"","topic":"tele/kostal/pikodata","qos":"0","retain":"true","broker":"359f0f5a.21b0c8","x":1085,"y":447,"wires":[]},{"id":"24fdee5.816a012","type":"function","z":"6421893c.968b4","name":"Watt","func":"var payload = msg.payload;\nvar watt = parseFloat(payload[0].replace(/\\r?\\n?/g, '').trim())||0.00;\nreturn {payload: watt};","outputs":1,"noerr":0,"x":790,"y":517,"wires":[["3db83bd8.cf0444"]]},{"id":"739861e7.0d058","type":"ui_gauge","z":"6421893c.968b4","name":"","group":"2c0d5acd.50dd7e","order":0,"width":0,"height":0,"gtype":"gage","title":"Tagesleistung kWh","label":"W","format":"{{value}}","min":0,"max":"12.00","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":990,"y":565,"wires":[]},{"id":"6b2b7b1e.c37b64","type":"function","z":"6421893c.968b4","name":"Day kWh","func":"var payload = msg.payload;\nvar watt = parseFloat(payload[1].replace(/\\r?\\n?/g, '').trim())||0.00;\nreturn {payload: watt};","outputs":1,"noerr":0,"x":800.5,"y":565,"wires":[["739861e7.0d058"]]},{"id":"ef8307b2.91ce1","type":"function","z":"6421893c.968b4","name":"Total kWh","func":"var payload = msg.payload;\nvar watt = parseFloat(payload[2].replace(/\\r?\\n?/g, '').trim())||0.00;\nreturn {payload: watt};","outputs":1,"noerr":0,"x":801.5,"y":614,"wires":[["33f0029e.b58166"]]},{"id":"3db83bd8.cf0444","type":"ui_chart","z":"6421893c.968b4","name":"","group":"2c0d5acd.50dd7e","order":0,"width":0,"height":0,"label":"Aktuell Watt","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":969.5,"y":517,"wires":[[],[]]},{"id":"33f0029e.b58166","type":"ui_chart","z":"6421893c.968b4","name":"","group":"2c0d5acd.50dd7e","order":0,"width":0,"height":0,"label":"Gesamtleistung","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":981.5,"y":614,"wires":[[],[]]},{"id":"132be680.13c062","type":"debug","z":"6421893c.968b4","name":"","active":false,"console":"false","complete":"false","x":370,"y":240,"wires":[]},{"id":"b474c455.1cd0c","type":"debug","z":"6421893c.968b4","name":"","active":false,"console":"false","complete":"false","x":590,"y":240,"wires":[]},{"id":"c1c2d803.d36378","type":"ui_text","z":"6421893c.968b4","group":"2c0d5acd.50dd7e","order":0,"width":0,"height":0,"name":"Current Date","label":"","format":"{{msg.payload}}","layout":"row-right","x":610,"y":160,"wires":[]},{"id":"78980e1e.2ee6b8","type":"moment","z":"6421893c.968b4","name":"","topic":"","input":"payload","inputType":"msg","inTz":"Europe/Vatican","adjAmount":"0","adjType":"hours","adjDir":"add","format":"dd, MM-DD-YYYY h:mm:ss a","locale":"en_GB","output":"payload","outputType":"msg","outTz":"Europe/Vatican","x":400,"y":180,"wires":[["b474c455.1cd0c","c1c2d803.d36378"]]},{"id":"359f0f5a.21b0c8","type":"mqtt-broker","z":"","broker":"10.1.1.94","port":"1883","clientid":"ndredMqtt","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"2c0d5acd.50dd7e","type":"ui_group","z":"","name":"Kostal Piko 5.5 Anlage","tab":"aa717a22.25e1b","order":3,"disp":true,"width":"6"},{"id":"aa717a22.25e1b","type":"ui_tab","z":"","name":"3. OG","icon":"dashboard","order":5}]

wow , i also have a kostal 5.5 :slight_smile:

dod you solve this? nice to have a card with that info :slight_smile:

i am new to node-red, can you make a full post how you did set this up ?

thnx verry much

@ pergola.fabio

  1. Goto NodeRed Homepage:
    https://nodered.org/docs/

  2. Install NodeRed
    https://nodered.org/docs/getting-started/installation

  3. Import Flow
    It can be imported straight into the editor by pasting the json into the
    Import dialog (Ctrl-I or via the dropdown menu).


see: https://nodered.org/docs/getting-started/first-flow

  1. Result

I use NodeRed on my Raspberry where the Home Assistant is installed.

1 Like

Wow, thnx for sharing… Well I have hassos running, gonna install nodered as an add-on… Should also work?

@petsie

btw, that flow you created, is that just grabbing some html info? like some sort of screenshot? or how does that work?

@ pergola.fabio

I use Node-Red UI:

Open your node-red instance and you should have UI nodes available at the bottom. The UI interface is available at http://localhost:1880/ui (if default node-red settings are used):

yes but i mean, this flow/code : [{“id”:“6421893c.968b4”,“type”:“tab”,“label”:“Kostal Piko”," …

how did you create that ? is that actually html grabbing what you do here? or how do you get the info from kostal ? is that actually opening some kind of webinterface in background, and then taking html output?

Change the PASSWORD and IPADDRESS

44

This element will get the request from the Kostal device as HTML and create the
GUI elements and the MQTT data for the HAS.
The flows can be used as an alternative to the node.js mqtt scripts.

"url": "http://pvserver:PASSWORD@IPADDRESS",
[
   {
      "id": "6421893c.968b4",
      "type": "tab",
      "label": "Kostal Piko",
      "disabled": false,
      "info": "All data from the kostal piko device and all\ns0 sensors..."
   },
   {
      "id": "5a855f4f.2a0728",
      "type": "inject",
      "z": "6421893c.968b4",
      "name": "Timer for data",
      "topic": "",
      "payload": "",
      "payloadType": "date",
      "repeat": "60",
      "crontab": "",
      "once": true,
      "onceDelay": "",
      "x": 120,
      "y": 180,
      "wires": [
         [
            "ab2edc17.89f03",
            "132be680.13c062",
            "78980e1e.2ee6b8"
         ]
      ]
   },
   {
      "id": "efd3d962.139b08",
      "type": "html",
      "z": "6421893c.968b4",
      "name": "Watt aktuell",
      "tag": "body > form > font > table:nth-child(2) > tr:nth-child(4) > td:nth-child(3)",
      "ret": "text",
      "as": "multi",
      "x": 550,
      "y": 640,
      "wires": [
         [
            "559eb16b.9b761"
         ]
      ],
      "outputLabels": [
         "watt"
      ]
   },
   {
      "id": "ab2edc17.89f03",
      "type": "http request",
      "z": "6421893c.968b4",
      "name": "Request: SET PASSWORD && IPADDRESS",
      "method": "GET",
      "ret": "txt",
      "url": "http://pvserver:PASSWORD@IPADDRESS",
      "tls": "",
      "x": 270,
      "y": 480,
      "wires": [
         [
            "efd3d962.139b08",
            "ca195eeb.84edf8",
            "7a9012cc.1145dc"
         ]
      ]
   },
   {
      "id": "ca195eeb.84edf8",
      "type": "html",
      "z": "6421893c.968b4",
      "name": "Tag kWh",
      "tag": "body > form > font > table:nth-child(2) > tr:nth-child(6) > td:nth-child(6)",
      "ret": "text",
      "as": "multi",
      "x": 540,
      "y": 360,
      "wires": [
         [
            "559eb16b.9b761"
         ]
      ],
      "outputLabels": [
         "daykwh"
      ]
   },
   {
      "id": "7a9012cc.1145dc",
      "type": "html",
      "z": "6421893c.968b4",
      "name": "Gesamtenergie kWh",
      "tag": "body > form > font > table:nth-child(2) > tr:nth-child(4) > td:nth-child(6)",
      "ret": "text",
      "as": "multi",
      "x": 580,
      "y": 740,
      "wires": [
         [
            "559eb16b.9b761"
         ]
      ],
      "outputLabels": [
         "kwh"
      ]
   },
   {
      "id": "559eb16b.9b761",
      "type": "join",
      "z": "6421893c.968b4",
      "name": "",
      "mode": "custom",
      "build": "array",
      "property": "payload",
      "propertyType": "msg",
      "key": "topic",
      "joiner": "\\n",
      "joinerType": "str",
      "accumulate": false,
      "timeout": "1",
      "count": "3",
      "x": 630,
      "y": 500,
      "wires": [
         [
            "938d9079.2d79d8",
            "24fdee5.816a012",
            "6b2b7b1e.c37b64",
            "ef8307b2.91ce1",
            "40c9d85a.9f19f8"
         ]
      ]
   },
   {
      "id": "40c9d85a.9f19f8",
      "type": "debug",
      "z": "6421893c.968b4",
      "name": "",
      "active": false,
      "console": "false",
      "complete": "payload.watt",
      "x": 830,
      "y": 320,
      "wires": []
   },
   {
      "id": "938d9079.2d79d8",
      "type": "function",
      "z": "6421893c.968b4",
      "name": "build payload",
      "func": "var payload = msg.payload,\n    o = {};\n    o.device   = \"Kostal PIKO 5.5 \";\n    o.time     = new Date().toLocaleString();\n    o.watt     = 0.00;\n    o.daykwh   = 0.00;\n    o.totalkwh = 0.00;\n// build the payload for the mqtt broker\nif(payload && payload.length) {\n   o.watt      = parseFloat(payload[0].replace(/\\r?\\n?/g, '').trim())||0.00;\n   o.daykwh    = parseFloat(payload[1].replace(/\\r?\\n?/g, '').trim())||0.00;\n   o.totalkwh  = parseFloat(payload[2].replace(/\\r?\\n?/g, '').trim())||0.00;\n   return {payload: o};\n} else {\n    return {payload: o};\n}",
      "outputs": 1,
      "noerr": 0,
      "x": 808.5,
      "y": 449,
      "wires": [
         [
            "c670457c.c1fdb8"
         ]
      ]
   },
   {
      "id": "c670457c.c1fdb8",
      "type": "mqtt out",
      "z": "6421893c.968b4",
      "name": "",
      "topic": "tele/kostal/pikodata",
      "qos": "0",
      "retain": "true",
      "broker": "359f0f5a.21b0c8",
      "x": 1085,
      "y": 447,
      "wires": []
   },
   {
      "id": "24fdee5.816a012",
      "type": "function",
      "z": "6421893c.968b4",
      "name": "Watt",
      "func": "var payload = msg.payload;\nvar watt = parseFloat(payload[0].replace(/\\r?\\n?/g, '').trim())||0.00;\nreturn {payload: watt};",
      "outputs": 1,
      "noerr": 0,
      "x": 790,
      "y": 517,
      "wires": [
         [
            "3db83bd8.cf0444"
         ]
      ]
   },
   {
      "id": "739861e7.0d058",
      "type": "ui_gauge",
      "z": "6421893c.968b4",
      "name": "",
      "group": "2c0d5acd.50dd7e",
      "order": 0,
      "width": 0,
      "height": 0,
      "gtype": "gage",
      "title": "Tagesleistung kWh",
      "label": "W",
      "format": "{{value}}",
      "min": 0,
      "max": "12.00",
      "colors": [
         "#00b500",
         "#e6e600",
         "#ca3838"
      ],
      "seg1": "",
      "seg2": "",
      "x": 990,
      "y": 565,
      "wires": []
   },
   {
      "id": "6b2b7b1e.c37b64",
      "type": "function",
      "z": "6421893c.968b4",
      "name": "Day kWh",
      "func": "var payload = msg.payload;\nvar watt = parseFloat(payload[1].replace(/\\r?\\n?/g, '').trim())||0.00;\nreturn {payload: watt};",
      "outputs": 1,
      "noerr": 0,
      "x": 800.5,
      "y": 565,
      "wires": [
         [
            "739861e7.0d058"
         ]
      ]
   },
   {
      "id": "ef8307b2.91ce1",
      "type": "function",
      "z": "6421893c.968b4",
      "name": "Total kWh",
      "func": "var payload = msg.payload;\nvar watt = parseFloat(payload[2].replace(/\\r?\\n?/g, '').trim())||0.00;\nreturn {payload: watt};",
      "outputs": 1,
      "noerr": 0,
      "x": 801.5,
      "y": 614,
      "wires": [
         [
            "33f0029e.b58166"
         ]
      ]
   },
   {
      "id": "3db83bd8.cf0444",
      "type": "ui_chart",
      "z": "6421893c.968b4",
      "name": "",
      "group": "2c0d5acd.50dd7e",
      "order": 0,
      "width": 0,
      "height": 0,
      "label": "Aktuell Watt",
      "chartType": "line",
      "legend": "false",
      "xformat": "HH:mm",
      "interpolate": "linear",
      "nodata": "",
      "dot": false,
      "ymin": "",
      "ymax": "",
      "removeOlder": 1,
      "removeOlderPoints": "",
      "removeOlderUnit": "3600",
      "cutout": 0,
      "useOneColor": false,
      "colors": [
         "#1f77b4",
         "#aec7e8",
         "#ff7f0e",
         "#2ca02c",
         "#98df8a",
         "#d62728",
         "#ff9896",
         "#9467bd",
         "#c5b0d5"
      ],
      "useOldStyle": false,
      "x": 969.5,
      "y": 517,
      "wires": [
         [],
         []
      ]
   },
   {
      "id": "33f0029e.b58166",
      "type": "ui_chart",
      "z": "6421893c.968b4",
      "name": "",
      "group": "2c0d5acd.50dd7e",
      "order": 0,
      "width": 0,
      "height": 0,
      "label": "Gesamtleistung",
      "chartType": "line",
      "legend": "false",
      "xformat": "HH:mm",
      "interpolate": "linear",
      "nodata": "",
      "dot": false,
      "ymin": "",
      "ymax": "",
      "removeOlder": 1,
      "removeOlderPoints": "",
      "removeOlderUnit": "3600",
      "cutout": 0,
      "useOneColor": false,
      "colors": [
         "#1f77b4",
         "#aec7e8",
         "#ff7f0e",
         "#2ca02c",
         "#98df8a",
         "#d62728",
         "#ff9896",
         "#9467bd",
         "#c5b0d5"
      ],
      "useOldStyle": false,
      "x": 981.5,
      "y": 614,
      "wires": [
         [],
         []
      ]
   },
   {
      "id": "132be680.13c062",
      "type": "debug",
      "z": "6421893c.968b4",
      "name": "",
      "active": false,
      "console": "false",
      "complete": "false",
      "x": 370,
      "y": 240,
      "wires": []
   },
   {
      "id": "b474c455.1cd0c",
      "type": "debug",
      "z": "6421893c.968b4",
      "name": "",
      "active": false,
      "console": "false",
      "complete": "false",
      "x": 590,
      "y": 240,
      "wires": []
   },
   {
      "id": "c1c2d803.d36378",
      "type": "ui_text",
      "z": "6421893c.968b4",
      "group": "2c0d5acd.50dd7e",
      "order": 0,
      "width": 0,
      "height": 0,
      "name": "Current Date",
      "label": "",
      "format": "{{msg.payload}}",
      "layout": "row-right",
      "x": 610,
      "y": 160,
      "wires": []
   },
   {
      "id": "78980e1e.2ee6b8",
      "type": "moment",
      "z": "6421893c.968b4",
      "name": "",
      "topic": "",
      "input": "payload",
      "inputType": "msg",
      "inTz": "Europe/Vatican",
      "adjAmount": "0",
      "adjType": "hours",
      "adjDir": "add",
      "format": "dd, MM-DD-YYYY h:mm:ss a",
      "locale": "en_GB",
      "output": "payload",
      "outputType": "msg",
      "outTz": "Europe/Vatican",
      "x": 400,
      "y": 180,
      "wires": [
         [
            "b474c455.1cd0c",
            "c1c2d803.d36378"
         ]
      ]
   },
   {
      "id": "359f0f5a.21b0c8",
      "type": "mqtt-broker",
      "z": "",
      "broker": "10.1.1.94",
      "port": "1883",
      "clientid": "ndredMqtt",
      "usetls": false,
      "compatmode": true,
      "keepalive": "60",
      "cleansession": true,
      "birthTopic": "",
      "birthQos": "0",
      "birthPayload": "",
      "willTopic": "",
      "willQos": "0",
      "willPayload": ""
   },
   {
      "id": "2c0d5acd.50dd7e",
      "type": "ui_group",
      "z": "",
      "name": "Kostal Piko 5.5 Anlage",
      "tab": "aa717a22.25e1b",
      "order": 3,
      "disp": true,
      "width": "6"
   },
   {
      "id": "aa717a22.25e1b",
      "type": "ui_tab",
      "z": "",
      "name": "3. OG",
      "icon": "dashboard",
      "order": 5
   }
]

cool, thnx a lor for sharing, gonna try it later

you figured out that code yourself?
nice!!

Hello all,
I made a fork of https://github.com/Tafkas/KostalPikoPy to support python3 for pikopy.
And I also made a custom component for Kostal Piko in Home-Assistant, https://github.com/gieljnssns/My-Hassio-config/blob/master/config/custom_components/sensor/kostal.py .
The yams config is like this:

  - platform: kostal
    host: 'http://192.168.xx.xx'
    username: xxxxxxxxxx
    password: xxxxxxxxxx
    monitored_conditions:
      - solar_generator_power
      - consumption_phase_1
      - consumption_phase_2
      - consumption_phase_3
      - current_power
      - total_energy
      - daily_energy
      - string1_voltage
      - string1_current
      - string2_voltage
      - string2_current
      - string3_voltage
      - string3_current
      - l1_voltage
      - l1_power
      - l2_voltage
      - l2_power
      - l3_voltage
      - l3_power

solar_generator_power, consumption_phase_1, consumption_phase_2, consumption_phase_3 are only supported when you have a Kostal BA sensor installed (this is untested, I don’t have a BA sensor, code comes from https://github.com/lucasHSA/KostalPikoPy)

When this is all working I can make a PR to the original repository (so it can be installed with pip) and maybe a PR to HA…

Feedback welcome

I was about to test it out next week, the nodered option, I don’t have a BA sensor :frowning:

@pergola.fabio
only

      - solar_generator_power
      - consumption_phase_1
      - consumption_phase_2
      - consumption_phase_3

need a BA sensor

Ah ok, cool, indeed , I was reading your reply to fast :wink:

ok, tried your py file, lots of sensors :slight_smile:
after what time is the data refreshed?