Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
olli0815 opened this issue Sep 16, 2024 · 106 comments
Closed

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

olli0815 opened this issue Sep 16, 2024 · 106 comments

Comments

@olli0815
Copy link

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
Copy link
Owner

PLCHome commented Sep 19, 2024

For MIX this is implemented. What type is this?

@olli0815
Copy link
Author

MOD 10KTL3-XH(BP)

@PLCHome
Copy link
Owner

PLCHome commented Sep 19, 2024

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

@olli0815
Copy link
Author

tlxh

@PLCHome
Copy link
Owner

PLCHome commented Sep 19, 2024

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

@olli0815
Copy link
Author

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

@PLCHome
Copy link
Owner

PLCHome commented Sep 23, 2024

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
Copy link
Author

Makes sense.
How to check if they are readable?

@PLCHome
Copy link
Owner

PLCHome commented Sep 23, 2024

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

@PLCHome
Copy link
Owner

PLCHome commented Sep 23, 2024

On the mix I can read every parameter:
image

@olli0815
Copy link
Author

olli0815 commented Oct 4, 2024

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

@PLCHome
Copy link
Owner

PLCHome commented Oct 4, 2024

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
Copy link
Author

olli0815 commented Oct 5, 2024

enjoy !!

@PLCHome
Copy link
Owner

PLCHome commented Oct 17, 2024

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
Copy link
Owner

PLCHome commented Oct 17, 2024

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
Copy link
Owner

PLCHome commented Oct 17, 2024

      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

@olli0815
Copy link
Author

do you plan to implement?

@PLCHome
Copy link
Owner

PLCHome commented Oct 23, 2024

You would have to provide the information as described above, then I will include it and give you advice on how to test it

@olli0815
Copy link
Author

olli0815 commented Oct 23, 2024

action "tlxSet"
serialNum "CxxxxxxxxxxxxxxxxA"
type "time_segment1"
param1 "1"
param2 "14"
param3 "00"
param4 "16"
param5 "00"
param6 "1"

@olli0815
Copy link
Author

olli0815 commented Oct 23, 2024

action "readMinParam"
paramId "time_segment1"
serialNum "CxxxxxxxxxxxxxxxxA"
startAddr "-1"
endAddr "-1"

@olli0815
Copy link
Author

let me know if there is more info required

@PLCHome
Copy link
Owner

PLCHome commented Oct 23, 2024

Can you give me the response json from both?
Is it time_segment1, time_segment2 .. time_segment9 for all?

@olli0815
Copy link
Author

Can you give me the response json from both?
Is it time_segment1, time_segment2 .. time_segment9 for all? yes

@olli0815
Copy link
Author

->
action "readMinParam"
paramId "time_segment1"
serialNum "hkhkhkhkh"
startAddr "-1"
endAddr "-1"
<-
msg "11776-4096-"
success true

@olli0815
Copy link
Author

olli0815 commented Oct 23, 2024

->
action "tlxSet"
serialNum "jljljjljljljljlj"
type "time_segment1"
param1 "1"
param2 "14"
param3 "00"
param4 "16"
param5 "00"
param6 "0"
<-
msg "inv_set_success"
success true

@PLCHome
Copy link
Owner

PLCHome commented Oct 23, 2024

one tab further, as should be JSON as text in brackets {}

@olli0815
Copy link
Author

in firefox?
{"msg":"inv_set_success","success":true}
??

@PLCHome
Copy link
Owner

PLCHome commented Oct 23, 2024

in firefox?
{"msg":"inv_set_success","success":true}
??
Yes

But it is more complicated than it seems at first glance.

Let's start with sending.
param1 "1" and param6 "0" in the picture in the first message you can see "Battery First", "Load First". Please go through them all once and make a list of which selection is which number.

It is also important whether it is param1 or param6 .

The other will probably be Eanabel / Daisabel. Probably 0 Disable / 1 Eanabel but please check that too.

@olli0815
Copy link
Author

olli0815 commented Oct 23, 2024

action "tlxSet"
serialNum "ChhhA"
type "time_segment1" = time_segmentn
param1 "1" = Load First "2" = Battery First" "3" = Grid First
param2 "14" = hh_start
param3 "00" = mm_start
param4 "16" = hh_end
param5 "00" = mm_end
param6 "0" = Disable "1" = Enable

@PLCHome
Copy link
Owner

PLCHome commented Oct 23, 2024

Great thats easy!
Now the answer of readMinParam: {"msg":"11776-4096-","success":true}
This will not be so easy
Here you should try Param 1 with the same Param 2 to 6. Then Param 6. Then make a few changes to Param 2 to 5 with Param 1 and Param 6 fixed.
We'll guess, but I need a few samples.

I think 4096 is 1000 in HEX
that gives the low byte 00 in decimal which is 0 minutes
And the high byte 10 in decimal which is 16 hours
So the up time

But 11776 is 2E00 in HEX
that gives the low byte still 00 in decimal which is 0 minutes
And the high byte 2E in decimal which is 46 hours, which is nonsense.
But you only need 5 bits to represent 24:
2E is therefore 0010 1110 if we delete the first 3 bits this gives 0000 1110 or 0E which corresponds to 14 hours.

I now suspect that the query will return the following result:

I'm guessing please check it now

param1 "1" = Load First
param2 "14" = hh_start
param3 "30" = mm_start
results in $2E1E so 11806

param1 "2" = Battery First"
param2 "14" = hh_start
param3 "30" = mm_start
results in $4E1E so 19998

param1 "3" = Grid First
param2 "14" = hh_start
param3 "30" = mm_start
results in $6E1E so 28190

For the first number between "-"

param4 "16" = hh_end
param5 "30" = mm_end
param6 "0" = Disable
results in $101E so ‭4126‬

param4 "16" = hh_end
param5 "30" = mm_end
param6 "1" = Enable
results in $201E so ‭8222‬

For the second number. But here you can be completely wrong

@olli0815
Copy link
Author

sure thanks !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Don*t forget to send me the "buy my a coffee" link

@olli0815
Copy link
Author

growatt.0
2024-10-24 18:20:28.152 debug Read inverter setting pvOnOff : {"msg":"1","success":true,"param1":1}
growatt.0
2024-10-24 18:20:26.943 debug Read inverter setting timeSlot9 : {"msg":"0-0-","success":false}
growatt.0
2024-10-24 18:20:25.700 debug Read inverter setting timeSlot8 : {"msg":"0-0-","success":false}
growatt.0
2024-10-24 18:20:24.341 debug Read inverter setting timeSlot7 : {"msg":"0-0-","success":false}
growatt.0
2024-10-24 18:20:23.095 debug Read inverter setting timeSlot6 : {"msg":"0-0-","success":false}
growatt.0
2024-10-24 18:20:21.856 debug Read inverter setting timeSlot5 : {"msg":"0-0-","success":false}
growatt.0
2024-10-24 18:20:20.570 debug Read inverter setting timeSlot4 : {"msg":"0-0-","success":false}
growatt.0
2024-10-24 18:20:19.341 debug Read inverter setting timeSlot3 : {"msg":"8192-1024-","success":false}
growatt.0
2024-10-24 16:20:18.011 debug Read inverter setting timeSlot2 : {"msg":"41728-1054-","success":false}
growatt.0
2024-10-24 16:20:16.660 debug Read inverter setting timeSlot1 : {"msg":"11776-4096-","success":false}
growatt.0
2024-10-24 16:20:15.441 debug Read inverter setting pvActivePRate : {"msg":"100","success":true,"param1":100}
growatt.0
2024-10-24 16:20:14.021 debug Read inverter setting time : {"msg":"2024-10-24-18-21-52-","success":true,"param1":1729794112000}
growatt.0
2024-10-24 16:20:12.110 debug Growatt time for settings : 20ms
growatt.0
2024-10-24 16:20:12.110 debug Leave growattData :2502ms
growatt.0
2024-10-24 16:20:12.090 debug Growatt time for parseData : 94ms
growatt.0
2024-10-24 16:20:12.090 debug Growatt time for settings : 94ms

@olli0815
Copy link
Author

olli0815 commented Oct 24, 2024

reading seems to work, value are correct - providing the values as iob DP not

@PLCHome
Copy link
Owner

PLCHome commented Oct 24, 2024

Fuck...
change

static parseTLXHTimeSlot(val, resolve) {
    debugApi('parseTLXHTimeSlot:', val);
    if (val.success === true && val.msg) {
      const ar = val.msg
        .toString()
        .split('-')
        .map(n => parseInt(n, 10));
      if (ar.length > 18) {
      if (ar.length > 1) {

Line 120 in https://github.com/PLCHome/growatt/blob/master/lib/parseret.js

@PLCHome
Copy link
Owner

PLCHome commented Oct 24, 2024

Don*t forget to send me the "buy my a coffee" link

I didn't have one, if you want you can use PLChome (at) fontanestr (dot) de on paypal

@PLCHome
Copy link
Owner

PLCHome commented Oct 25, 2024

don't receive a message for the "time" data point as well

read:
on my inverter its:
action: readMixParam
paramId: pf_sys_time_mutli
serialNum: NxxxC
startAddr: -1
endAddr: -1

{"msg":"2024-10-25-10-8-38-","success":true}

Write:
action: mixSet
serialNum: NxxxxxC
type: pf_sys_year
param1: 2024-10-25 10:12

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

Maybe the date is transmitted differently here on the TLHX.

@PLCHome
Copy link
Owner

PLCHome commented Oct 25, 2024

I think I misunderstood the sentence... The date is still there...

	2024-10-24 17:08:39.538	debug	Read inverter setting time : {"msg":"2024-10-24-17-10-22-","success":true,"param1":1729789822000}

> new Date(1729789822000)
2024-10-24T17:10:22.000Z

@PLCHome
Copy link
Owner

PLCHome commented Oct 25, 2024

Then please change the length check from 18 to 1 this evening and it will work.

Then please check the problem with the zeros again. If that still doesn't work, I will add a workaround.

Sorry, I hit the wrong button. I didn't mean to close the ticket.

@PLCHome PLCHome closed this as completed Oct 25, 2024
@PLCHome PLCHome reopened this Oct 25, 2024
@olli0815
Copy link
Author

something seems to be wrong with the data points.
My simple blockly to set a deified time slot ((3 in this case):
image
through a message that the "ack" false when I try to set the value via blockly.

growatt.0 11:58:23.328 silly States user redis pmessage growatt.0..write/**growatt.0.1929535.devices.klklkklk.settings.timeSlot3.write:{"val":true,"ack":false,"ts":1729850303318,"q":0,"c":"script.j**s.MeineSkripte.pv.Load_Battery","from":"system.adapter.javascript.0","user":"system.user.admin","lc":1729850303318}*

@olli0815
Copy link
Author

so I can set the values via Admin GUI but not via script

@PLCHome
Copy link
Owner

PLCHome commented Oct 25, 2024

It is not necessary to set "Write to Inverter" to false. Rewrite with value=true ack=false triggers it.
Just as it shown in the log.
Maybe that will solve the problem.
Unfortunately, I'm a programmer and not a painter. I don't know Blocky and can't do anything with it.

Is the problem with the 0 values ​​still there?

@olli0815
Copy link
Author

olli0815 commented Oct 25, 2024

okay ;-)
the reading seems to work, after deleting settings node once again.
The Initial read after restarting:
image

@PLCHome
Copy link
Owner

PLCHome commented Oct 25, 2024

If I look closely, it says:
Write false to write after 1 second
Write Enabled after 1/2 second
Write true to write directly
The last point needs 2 seconds...

bease:
Write true to write
Write Enabled
Write false to write
That's what it does

try this

image

@olli0815
Copy link
Author

olli0815 commented Oct 25, 2024

net schlecht !!! Läuft.
my script initialized the value while setting it 1 sec later - stupid mistake ;-(
Thanks !!!!

edit, at the end initializing the boolean is not necessary anyway...

@PLCHome
Copy link
Owner

PLCHome commented Oct 25, 2024

Ok, now that everything is running I'll build a test release.

Ok?

@olli0815
Copy link
Author

yes, reading normal time is working as well

PLCHome added a commit that referenced this issue Oct 25, 2024
…ng and support.

- (PLCHome) Added Inverter On Off for TLX und TLXH. Thanks to olli0815 for debugging and support.

any chance to set time slots for load prios? #51
@PLCHome PLCHome closed this as completed Oct 25, 2024
@PLCHome
Copy link
Owner

PLCHome commented Oct 25, 2024

Does the THLX have a switch for charging from the grid? I used this function on my inverter at Tibber at reasonable prices.

@olli0815
Copy link
Author

Yes, I thought it at well.
It's a simple parameter.
Will provide details tomorrow.

@PLCHome PLCHome reopened this Oct 25, 2024
@olli0815
Copy link
Author

olli0815 commented Oct 26, 2024

write:
action "tlxSet"
serialNum "CZjllljl04A"
type "ac_charge"
param1 "1"

response
"msg": "inv_set_success",
"success": true

read
action "readMinParam"
paramId "ac_charge"
serialNum "CZkkkkkk04A"
startAddr "-1"
endAddr "-1"

response
"msg": "1",
"success": true

@PLCHome
Copy link
Owner

PLCHome commented Oct 26, 2024

Are there any other interesting parameters? Battery maximum, minimum or something else?

@olli0815
Copy link
Author

not yet, just started to play around with the inverter, evcc, PV FC and tibber.
Main use case was to avoid discharging battery when car needs to be loaded fast by evcc (solved with setting battery first at the same time) and charge the battery when PV Forecast is low - usually at 3:00 at night (Battery first for one hour at night).
I guess with being able to completely switch the inverter off as well, I should have enough settings for controlling the inverter,

@PLCHome
Copy link
Owner

PLCHome commented Oct 26, 2024

Please change in the Growatt node and test:
https://github.com/PLCHome/growatt/blob/master/lib/growatttype.js

If the parameter only has a value Boolean or % it goes quickly, they are already implemented :-)

@olli0815
Copy link
Author

works, thanks again !!

@PLCHome PLCHome closed this as completed Oct 26, 2024
@PLCHome
Copy link
Owner

PLCHome commented Oct 26, 2024

If you need more settings or parameters feel free to open a new ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants