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

can't set konf_neigung to non-integer value #15

Closed
monojk opened this issue Oct 19, 2022 · 17 comments · Fixed by #16
Closed

can't set konf_neigung to non-integer value #15

monojk opened this issue Oct 19, 2022 · 17 comments · Fixed by #16

Comments

@monojk
Copy link

monojk commented Oct 19, 2022

I try to set the konf_neigung_rw-0x0b35 to 1.3 but it finally rounds the value (seen by rget) although it prints that the wanted value was successfully set. At the Vitodens-300W I see 1,0 instead of 1,3

pi@rp4b:~ $ /home/pi/go/bin/vitotrol -verbose set konf_neigung_rw-0x0b35 1.3
Working with device VT 200 (HO1C)@75014............
konf_neigung_rw-0x0b35 attribute successfully set to `1.3'
pi@rp4b:~ $ /home/pi/go/bin/vitotrol rget konf_neigung_rw-0x0b35
konf_neigung_rw-0x0b35: 1@2022-10-19 11:21:28 (konf_neigung_rw)

pi@rp4b:~ $ /home/pi/go/bin/vitotrol -verbose set konf_neigung_rw-0x0b35 2
Working with device VT 200 (HO1C)@75014............
konf_neigung_rw-0x0b35 attribute successfully set to `2'
pi@rp4b:~ $ /home/pi/go/bin/vitotrol rget konf_neigung_rw-0x0b35
konf_neigung_rw-0x0b35: 2@2022-10-19 11:22:20 (konf_neigung_rw)

pi@rp4b:~ $ /home/pi/go/bin/vitotrol -verbose set konf_neigung_rw-0x0b35 1
Working with device VT 200 (HO1C)@75014............
konf_neigung_rw-0x0b35 attribute successfully set to `1'
pi@rp4b:~ $ /home/pi/go/bin/vitotrol rget konf_neigung_rw-0x0b35
konf_neigung_rw-0x0b35: 1@2022-10-19 11:23:03 (konf_neigung_rw)

@monojk
Copy link
Author

monojk commented Sep 18, 2024

Any progress here?

@maxatome
Copy link
Owner

Nope.
It probably means this attribute accepts only integer values?
Do you succeed to set it to a floating value using another way (vitodata app or website)? If yes, print the value using vitotrol to see it. Perhaps the decimal separator should not be a "."?

@monojk
Copy link
Author

monojk commented Sep 18, 2024

I tried it with 1,4 but failed at the conversion:

home/pi/go/bin/vitotrol -verbose set konf_niveau_rw-0x0b3b 0 konf_neigung_rw-0x0b35 1,4
Working with device VT 200 (HO1C)@xxxxxxxxxxxxxx
*** value `1,4' of attribute konf_neigung_rw-0x0b35 is invalid: strconv.ParseFloat: parsing "1,4": invalid syntax

Vitotrol app doesn't have the posibility so set this attribute. With the web interface vitodata100 I can change it to 1,4:
vitodata100

@maxatome
Copy link
Owner

And when you set it to 1.4 using the web interface vitodata100, what does /home/pi/go/bin/vitotrol rget konf_neigung_rw-0x0b35 print?

@monojk
Copy link
Author

monojk commented Sep 18, 2024

I set 1,4 on the web interface and get the expected value:

/home/pi/go/bin/vitotrol rget konf_neigung_rw-0x0b35
konf_neigung_rw-0x0b35: 1.4@2024-09-18 15:42:55 (konf_neigung_rw)

@maxatome
Copy link
Owner

At https://github.com/maxatome/go-vitotrol/blob/master/vitotrol.go#L39, you can try to add:

 	client := &http.Client{}
+ 	log.Println("SEND(" + reqBody + ")")
 	req, err := http.NewRequest("POST", MainURL,

to check you have well:

SEND(<DatapointId>…</DatapointId><Wert>1.4</Wert>)

after recompiling when you do:

vitotrol -verbose set konf_neigung_rw-0x0b35 1.4

@monojk
Copy link
Author

monojk commented Sep 18, 2024

Ok, can you refresh my mind how to Compiler the changes?

@maxatome
Copy link
Owner

  1. retrieve the repo
  2. go to vitotrol command directory
  3. build vitotrol executable

git clone https://github.com/maxatome/go-vitotrol.git
cd go-vitotrol/cmd/vitotrol
go install .

@monojk
Copy link
Author

monojk commented Sep 18, 2024

Yes, I saw

<DatapointId>2869</DatapointId><Wert>1.4</Wert>

@maxatome
Copy link
Owner

In this case I don't know what to do to fix this issue, as if 1.4 is well sent then I don't understand why the server only keeps the integer part :(

@maxatome
Copy link
Owner

maxatome commented Sep 18, 2024

we can try 1,4 instead of 1.4 as a last resort:
here https://github.com/maxatome/go-vitotrol/blob/master/vitotrol.go#L10 add

 	"sort"
+	"strings"
 )

then just before the log.Println("SEND(" + reqBody + ")") line you added above:

 	client := &http.Client{}
+ 	reqBody = strings.Replace(reqBody, ".", ",", 1)
+	log.Println("SEND(" + reqBody + ")")
 	req, err := http.NewRequest("POST", MainURL,

@monojk
Copy link
Author

monojk commented Sep 18, 2024

I am debugging further with setting also on the vitotrol100 web interface. Therse seems to be some delay. A mouse over the field says that there is only a gradual and delayed change. Maybe that is reason why the change isn't reflected by the rget call...

@monojk
Copy link
Author

monojk commented Sep 18, 2024

Great, this fixed the problem:

        "strings"
....
 	reqBody = strings.Replace(reqBody, ".", ",", 1)

Many thanks, merci beaucoup.

@maxatome
Copy link
Owner

Cool! We are lucky :D
I will do a PR ASAP.

maxatome added a commit that referenced this issue Sep 18, 2024
Closes #15.

Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
maxatome added a commit that referenced this issue Sep 18, 2024
Closes #15.

Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
maxatome added a commit that referenced this issue Sep 18, 2024
Closes #15.

Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
@maxatome
Copy link
Owner

@monojk could you please test the PR #16?
In the go-vitotrol directory, do:

git checkout -- .
git fetch
git checkout fix-float
cd cmd/vitotrol
go install .

maxatome added a commit that referenced this issue Sep 18, 2024
Closes #15.

Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
@monojk
Copy link
Author

monojk commented Sep 19, 2024

Thanks, it works:

$ /home/pi/go/bin/vitotrol -verbose set konf_neigung_rw-0x0b35 1.4
Working with device VT 200 (HO1C)@7501..............
konf_neigung_rw-0x0b35 attribute successfully set to `1,4'

$/home/pi/go/bin/vitotrol rget konf_neigung_rw-0x0b35
konf_neigung_rw-0x0b35: 1.4@2024-09-19 09:50:28 (konf_neigung_rw)

@maxatome
Copy link
Owner

Cool!

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

Successfully merging a pull request may close this issue.

2 participants