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

Unexpected http code #17

Open
spacewalker56 opened this issue Jul 8, 2023 · 25 comments
Open

Unexpected http code #17

spacewalker56 opened this issue Jul 8, 2023 · 25 comments

Comments

@spacewalker56
Copy link

Dear Sincze,

I installed the Delta_inverter.php in Domoticz
I altered the username, password and Domoticzdevice and also the website port number to port 8084.
Executing the php command I get no error but in the log I see this error.
I get no values in my Delta screen.
How could I solve this?

2023-07-08 07:45:02.686 Status: --->> Cookie File: /var/tmp/Delta.cookie exists!
2023-07-08 07:45:02.691 Status: --->> Cookie File: /var/tmp/Delta.cookie is writable!
2023-07-08 07:45:02.695 Status: --->> Login OK to proceed ->
2023-07-08 07:45:02.897 Status: --->> Delta inverter: Data: Unexpected HTTP code:

@sincze
Copy link
Owner

sincze commented Jul 8, 2023

10:15: mmm damn I would have hoped the last line would have mentioned the code it received. Let me check.
10:20: I committed / released a new version of the script. Can you try that one so we can see the results ?

@spacewalker56
Copy link
Author

Hi Sincze, thank you for your very quick reply.

I altered the script and restarted it, I got no error in the log file.

2023-07-08 12:24:00.257 Status: --->> Cookie File: /var/tmp/Delta.cookie exists!
2023-07-08 12:24:00.257 Status: [web:8084] Incoming connection from: 127.0.0.1
2023-07-08 12:24:00.263 Status: --->> Cookie File: /var/tmp/Delta.cookie is writable!
2023-07-08 12:24:00.267 Status: --->> Login OK to proceed ->

So far so good. I now have to wait till I can see some values. Still 0 watt.
It should give me 3000 Watt at this moment.

Thank you for your assistance. I hope I get it to work. If you have more clues I would like to hear them.

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 8, 2023

Extra information,

I have very often a reset all device statuses...

2023-07-08 12:33:40.734 Status: EventSystem: reset all device statuses...
2023-07-08 12:34:05.383 Status: --->> Cookie File: /var/tmp/Delta.cookie exists!
2023-07-08 12:34:05.388 Status: --->> Cookie File: /var/tmp/Delta.cookie is writable!
2023-07-08 12:34:05.391 Status: --->> Login OK to proceed ->
2023-07-08 12:35:12.694 RFXCOM: Temp + Humidity (Cresta)

@sincze
Copy link
Owner

sincze commented Jul 9, 2023

Is it working as expected??

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 9, 2023

Hi Sandor,

I get no error message but I also receive no data.
Scherm­afbeelding 2023-07-09 om 17 22 46

Scherm­afbeelding 2023-07-09 om 17 23 15 Scherm­afbeelding 2023-07-09 om 17 27 35

2023-07-09 17:25:02.824 Status: --->> Cookie File: /var/tmp/Delta.cookie exists!
2023-07-09 17:25:02.829 Status: --->> Cookie File: /var/tmp/Delta.cookie is writable!
2023-07-09 17:25:02.832 Status: --->> Login OK to proceed ->
2023-07-09 17:25:23.063 Tuyacloud: onHeartbeat called time=1688916323.063605

@spacewalker56
Copy link
Author

I would like to know of there is code or a command so i can see of any data is received or available.

@sincze
Copy link
Owner

sincze commented Jul 9, 2023

I would like to know of there is code or a command so i can see of any data is received or available.

Option:
Change: //print_r($result);
To: print_r($result);

And run the script from the prompt.

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 9, 2023

This is what i got back at the prompt.

pi@Domoticz:/domoticz/scripts/pass2php $ php /home/pi/domoticz/scripts/pass2php/delta_inverter.php
{"errmsg":"","sucmsg":""}pi@Domoticz:
/domoticz/scripts/pass2php $

In the logfile eveything seems normal.

@sincze
Copy link
Owner

sincze commented Jul 9, 2023

Did it ever work or stopped working.
The DELTA inverter from my monitoring system has been replaced by GoodWe so I don't have working credentials anymore to do further testing on the login proces.

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 9, 2023 via email

@sincze
Copy link
Owner

sincze commented Jul 10, 2023

It has never worked. I never tried before. It a pity you can’t test anymore. Thank you for you replies and for the script. Good luck. Ruud

On 9 Jul 2023 at 18:16 +0200, Sandor @.>, wrote: Did it ever work or stopped working. The DELTA inverter from my monitoring system has been replaced by GoodWe so I don't have working credentials anymore to do further testing on the login proces. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.>

If you want. you can assign a temp pwd to it and I'll try to use yours to fix the script so you can use it.

Repository owner deleted a comment from spacewalker56 Jul 10, 2023
Repository owner deleted a comment from spacewalker56 Jul 10, 2023
@sincze
Copy link
Owner

sincze commented Jul 10, 2023

Working on it.
I do already see 1 thing and that is there are 2 inverters listed in your account.

In your case 20:32 I now have: Delta Inverter: for domoticz: 147;25891

2023-07-10 20:37:47.883 Status: --->>Delta: Delta Inverter: 128 for domoticz: 128;25891
2023-07-10 20:37:47.885 Status: --->>Delta: (udevice) | **** => 0,128;25891

@spacewalker56
Copy link
Author

Sorry Sandor, I was very busy and did not check my email for the last 2 days.

You found a way to solve the problem. I also notices I have 2 inverters listed but because of former problems i am afraid to delete the first one. Maybe i delete him anyway.

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 12, 2023

Hi Sandor,

I did not edit the plant information yet.

this is the error i get running the php script'

pi@Domoticz:~/domoticz/scripts/pass2php $ php /home/pi/domoticz/scripts/pass2php/delta_inverter.php
extract_plantid_from_data
PHP Notice: Undefined offset: 0 in /home/pi/domoticz/scripts/pass2php/delta_inverter.php on line 289

Notice: Undefined offset: 0 in /home/pi/domoticz/scripts/pass2php/delta_inverter.php on line 289

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 12, 2023

Hi Sandor

I tried to remove the ['0'] at the end if line 289. After that i didnt get an error message running the script but i still get no data in Domoticz

The last line was temporary, running the script now gives me again the php notice.

I am no programmer, but has this failure to do with the P_cid value?

@sincze
Copy link
Owner

sincze commented Jul 12, 2023

Mmmm interesting. I got
Delta Inverter: for domoticz: 107;25891

... let me tweak it a bit. for you. New script is live added 1 line of code.

Do not alter the script! with the keys e.g. it should work just fine.

2023-07-12 21:01:17.386 Status: --->>Delta: Login OK to proceed ->
2023-07-12 21:01:39.258 Status: --->>Delta: Delta Inverter: 79 for domoticz: 79;25891
2023-07-12 21:01:39.261 Status: --->>Delta: (udevice) | **** => 0,79;25891

@spacewalker56
Copy link
Author

Hi Sandor,

thank you for you reply. I copied the script into the folder.
After running the php script I get no errors on the prompt. Of course I tried with my credentials and then there were the same errors as before. Changing it back removed the php notifications. My idx is 2116. I think I should use that?
I also changed my portnumber to 8084.

I notice, there is something else going on. Using my deltasolar- owner-account I still get the error messages.
Using the account I provided to you everything seems to work as I hoped for.
I received with those credentials the total of energy I produced this year.
I will have al look tomorrow, when the sun shines again what values I receive.

Thank you so far. I will get a new password on my head account. I have no idea why this login which I use on the website too, doesn't work.
I keep you posted.

I would never have solved this on my own.

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 12, 2023

Something strange happens,

off course I tried to use my owner username and password and I don't get that to work.
After changing back to the username and the password I provided to you, I get the same php notifications all the time.
maybe I am being refused bij the website now. I will try tomorrow again.

I removed the empty plant so I only have one plant now. Maybe this influences the result.

thanks
,

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 13, 2023

I am not able to get it to work anymore.

I added some accounts with the same passwords and it doesn't solve the problem.
I think it has something to do with the accounts, because the owner account didn't work from the start and the viewer account you use worked, till yesterday evening.

This is the errormessage again:

pi@Domoticz:~/domoticz/scripts/pass2php $ php /home/pi/domoticz/scripts/pass2php/delta_inverter.php
extract_plantid_from_data
PHP Notice: Undefined offset: 0 in /home/pi/domoticz/scripts/pass2php/delta_inverter.php on line 290

Notice: Undefined offset: 0 in /home/pi/domoticz/scripts/pass2php/delta_inverter.php on line 290

I feel a little silly because it seemed to work yesterday.

My plant-id is 5502re27tijs and i have only one inverter.

@sincze
Copy link
Owner

sincze commented Jul 13, 2023

I can see that with the credentials I got provided there now is only 1 inverter left.
I updated the code for you.

Delta Inverter: for Domoticz: 270;25891

Tested 21:13 with separate script still for me shows:

Login: OK ready to proceed
Retrieve Data OK
Parsing Received Data OK
Delta Inverter: for Domoticz: 63;25891

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 13, 2023 via email

@sincze
Copy link
Owner

sincze commented Jul 13, 2023

Hi Sandor, I imported the script and I get values now. The value 25891 is the same as yesterday. It could be the total I produced since my registration Today I produced 15,46 kWh according to myDeltaSolar. Thank you so far.  I would like to know what commands you used to get info from myDeltaSolar . Thank you again. Ruud

On 13 Jul 2023 at 19:58 +0200, Sandor @.>, wrote: I can see that with the credentials I got provided there now is only 1 inverter left. I updated the code for you. Delta Inverter: for domoticz: 270;25891 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.>

A well we will get there eventually. At least you have some data now.
The DELTA website is a bit sluggish..... (SLOWWWWWWWWWWW).

To see the commands I used check the URL's in the script that are being called.

If you install 'FIDDLER' for example, login to delta portal, you can see all the hidden stuff flying by by just clicking on the delta webpage.

I do notice that the DELTA app reveils the total number generated in MWh.
Let me try to get that value.

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 13, 2023 via email

@sincze
Copy link
Owner

sincze commented Jul 15, 2023

It could be that we still need 1 tweak as stated by you.

The 25891 in the webinterface is so it seems MWh (total generated).
To put this into a Domoticz sensor this needs to be done in:

ENERGY = Integer, total cumulative energy in Watt-hours (Wh)

So a small tweak in the following function can do that:

function extract_today_power_from_data($plant_id,$queryresult)
{
	$today_power=false;
	$queryresult = json_decode($queryresult, JSON_PRETTY_PRINT);
	if(isset($queryresult['P_cid'])) 
	{
		$today_power=$queryresult['P_cid'][$plant_id]['0'];
		$today_power=$today_power*1000;  // Shown in MWh convert to kWh
		$today_power=$today_power*1000;  // Convert kWh to Wh
	}
}

@spacewalker56
Copy link
Author

spacewalker56 commented Jul 17, 2023 via email

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