PLCHome / ioBroker.growatt

growatt adapter for ioBroker
MIT License
16 stars 5 forks source link

any chance to set time slots for load prios? #51

Open olli0815 opened 1 month ago

olli0815 commented 1 month ago

No bug, rather an ask - but fist things first Thanks for the Adapter !!.

Would it be possible to set more values then the given channels under settings? background I wand to set load prios more dynamic to reflect dynamic energy tariffs.

Bildschirmfoto vom 2024-09-16 18-04-05 Ole

PLCHome commented 1 month ago

For MIX this is implemented. What type is this?

olli0815 commented 1 month ago

MOD 10KTL3-XH(BP)

PLCHome commented 1 month ago

Oh sorry, the type of the used interface by the webgui out of this datapoint: growatt.\<nr>.\<nr>.devices.\<sn>.growattType

olli0815 commented 1 month ago

tlxh

PLCHome commented 1 month ago

Ok "tlxh" that make sense. If you activate the "advanced settings" is there a possibility to read the time slots?

olli0815 commented 1 month ago

No, Not yet. I ticket all options, no time slots in the data.

PLCHome commented 3 weeks ago

Just writing can also work, but then it's a blind flight because it only works in one direction. To explain: The values ​​are displayed when you open the page on the Growatt homepage. However, they are transmitted in the source code of the page. But that's not how the adapter works. It would like to query the values. If there is no way to query the values, I don't like to implement it.

olli0815 commented 3 weeks ago

Makes sense. How to check if they are readable?

PLCHome commented 3 weeks ago

At the mix: to set: image to Read, first Advanced Setting then read: image

PLCHome commented 3 weeks ago

On the mix I can read every parameter: image

olli0815 commented 2 weeks ago

Bildschirmfoto vom 2024-10-04 15-22-51 I'm able to read the "slots" too via App / WebInterface

PLCHome commented 2 weeks ago

That's good. But at the moment I'm on vacation in the US. Going down the west coast from SFO to LA. Let's have a look in a bit more than a week. After that I will explain what you have to do that I can implement the settings.

olli0815 commented 2 weeks ago

enjoy !!

PLCHome commented 3 days ago

to recreate the command. Open the browser, the Growatt page and activate the developer tools with F12. Then click on Network. "tcpSet.do" is called to read and write.

I would need to read and write each parameter once. A hard copy of Payload and the text in Response and the response...

image

{"msg":"100-99-0-0-0-0-0-0-0-0-2828-3342-0-0-0-0-0-0-0-","success":true}

image

Please enter different values ​​in all fields so that you can see where something is.

PLCHome commented 3 days ago

image

{"msg":"inv_set_success","success":true}

image

Please enter different values ​​in all fields so that you can see where something is. This example is bad...

PLCHome commented 3 days ago
      gridFirst: {
        name: 'Grid first',
        type: 'mix_ac_discharge_time_period',
        paramId: 'MIX_AC_DISCHARGE_TIME_MULTI',
        parseRet: PARSERET.parseGritFirst,
        param: {
          param1: { name: 'Discharge power rate', type: 'INUM_0_100', unit: '%' },
          param2: { name: 'Discharge stopped soc', type: 'INUM_0_100', unit: '%' },
          param3: { name: 'Time slot 1 start HH', type: 'INUM_0_24' },
          param4: { name: 'Time slot 1 start MI', type: 'INUM_0_60' },
          param5: { name: 'Time slot 1 end HH', type: 'INUM_0_24' },
          param6: { name: 'Time slot 1 end MI', type: 'INUM_0_60' },
          param7: { name: 'Time slot 1 on', type: 'BOOL' },
          param8: { name: 'Time slot 2 start HH', type: 'INUM_0_24' },
          param9: { name: 'Time slot 2 start MI', type: 'INUM_0_60' },
          param10: { name: 'Time slot 2 end HH', type: 'INUM_0_24' },
          param11: { name: 'Time slot 2 end MI', type: 'INUM_0_60' },
          param12: { name: 'Time slot 2 on', type: 'BOOL' },
          param13: { name: 'Time slot 3 start HH', type: 'INUM_0_24' },
          param14: { name: 'Time slot 3 start MI', type: 'INUM_0_60' },
          param15: { name: 'Time slot 3 end HH', type: 'INUM_0_24' },
          param16: { name: 'Time slot 3 end MI', type: 'INUM_0_60' },
          param17: { name: 'Time Slot 3 on', type: 'BOOL' },
        },
  static parseGritFirst(val, resolve) {
    debugApi('parseGritFirst:', val);
    if (val.success === true && val.msg) {
      const ar = val.msg
        .toString()
        .split('-')
        .map(n => parseInt(n, 10));
      if (ar.length > 18) {
        let time = '';
        [val.param1, val.success] = fNum(ar[0], 0, 100, val.success);
        [val.param2, val.success] = fNum(ar[1], 0, 100, val.success);
        [time, val.success] = fTime(ar[10], val.success);
        [val.param3, val.success] = fNum(time.substring(0, 2), 0, 24, val.success);
        [val.param4, val.success] = fNum(time.substring(3, 6), 0, 60, val.success);
        [time, val.success] = fTime(ar[11], val.success);
        [val.param5, val.success] = fNum(time.substring(0, 2), 0, 24, val.success);
        [val.param6, val.success] = fNum(time.substring(3, 6), 0, 60, val.success);
        [val.param7, val.success] = fBool(ar[12], val.success);
        [time, val.success] = fTime(ar[13], val.success);
        [val.param8, val.success] = fNum(time.substring(0, 2), 0, 24, val.success);
        [val.param9, val.success] = fNum(time.substring(3, 6), 0, 60, val.success);
        [time, val.success] = fTime(ar[14], val.success);
        [val.param10, val.success] = fNum(time.substring(0, 2), 0, 24, val.success);
        [val.param11, val.success] = fNum(time.substring(3, 6), 0, 60, val.success);
        [val.param12, val.success] = fBool(ar[15], val.success);
        [time, val.success] = fTime(ar[16], val.success);
        [val.param13, val.success] = fNum(time.substring(0, 2), 0, 24, val.success);
        [val.param14, val.success] = fNum(time.substring(3, 6), 0, 60, val.success);
        [time, val.success] = fTime(ar[17], val.success);
        [val.param15, val.success] = fNum(time.substring(0, 2), 0, 24, val.success);
        [val.param16, val.success] = fNum(time.substring(3, 6), 0, 60, val.success);
        [val.param17, val.success] = fBool(ar[18], val.success);
      } else {
        val.success = false;
      }
    } else {
      val.success = false;
    }
    debugApi('parseGritFirst result:', val);
    resolve(val);
  }

And that is then incorporated into the source code... actually no secret