Repository navigation
Description
Expected Behaviour
I am trying to use the Remote Control plugin sending set commands to configure from an external script the Oculars TelradVieW, i.e. the diameter of the Telrad circles.
This works fine for many other settings, but I do not get it working for this specific purpose.
My python code is:
##################################
# Set FOV Circular markers size in degrees
# Warning: this command does not seem to work, despite
# the fact that it does not produce errors.
# Configure instead the size of the rings
# in the Oculars UI (see section 8 of the hlcc User Manual)
# GCH: I feel that there is a problem with the passing of the
# parameters, but I could not make it working
#
# Imports to create http requests to the remote control
# server of stellarium
#
import requests
import subprocess
#
# Root URL to communicate with the stellarium remote control server
# Put here the correct IP address and make sure that the remote control plugin is
# configured and running.
#
ip = "127.0.0.1"
url_main = f"http://{ip}:8090/api/"
property = "Oculars.telradFOV"
#marker_sizes = [0.16, 0.06, 0.0, 0.0] # 10 arcmin, 4 arcmin
#marker_sizes = "'[0.16, 0.06, 0.0, 0.0]'" # 10 arcmin, 4 arcmin
marker_sizes = "0.16,0.06,0.0,0.0" # Test values
param_fov_marker = {"id" : property, "value": marker_sizes}
telrad_fov = requests.post(url_main + 'stelproperty/set', data=param_fov_marker)
properties = requests.get(url_main + 'stelproperty/list')
print("Current FOV markers {}: {}".format(property, properties.json().get(property).get("value")))
print("Set size for Telrad FOV circular markers: ", telrad_fov, " to: ", marker_sizes, " deg")
properties = requests.get(url_main + 'stelproperty/list')
print("New FOV markers {}: {}".format(property, properties.json().get(property).get("value")))
#print(properties.json())
##################
I would expect the output:
eltdev@elthlccd275 ~/tmp $ python3 ./oculars.py
Current FOV markers Oculars.telradFOV: [0.03, 0.08, 0, 0]
Set size for Telrad FOV circular markers: <Response [200]> to: 0.16,0.06,0.0,0.0 deg
New FOV markers Oculars.telradFOV: [0.16, 0.06, 0, 0]
Actual Behaviour
Instead I get:
eltdev@elthlccd275 ~/tmp $ python3 ./oculars.py
Current FOV markers Oculars.telradFOV: [0.03, 0.08, 0, 0]
Set size for Telrad FOV circular markers: <Response [200]> to: 0.16,0.06,0.0,0.0 deg
New FOV markers Oculars.telradFOV: [0.03, 0.08, 0, 0]
i.e. the new Telrad values are not set, even though I get an OK reply <Response [200]>
I have tried several formats for defining marker_sizes, a few of them commented out in the code above, but none works.
I believe that the uncommented one should be correct one.
Or there is a syntax for setting marker_sizes that I have not tried, or there is a bug in manipulating this property.
Steps to reproduce
Stat stellarium with the Remote Control and Oculars plugin enables and run the python script pasted above.
System
- Stellarium version: 25.3
- Operating system: AlmaLinux release 10.1 (Heliotrope Lion)
Logfile
Nothing useful in the log file
Help would be very much appreciated!!!
Thanks in advance.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
alex-w commentedon Feb 19, 2026
Oculars.telradFOVis expectedVec4fas parameter, not a stringgchiozzi commentedon Feb 19, 2026
Thanks @alex-w, I have seen that, but my understanding was that the conversion was done along the way down through the web server of the Remote control plugin.
Do you know what syntax should I use in the string that I pass to the post command to have it understood as a Vec4f and passed down to the Oculars plugin in the right way?
gchiozzi commentedon Feb 19, 2026
By the way, I have asked both google ai and copilot.
They give me essentially the same code I have posted above, but with two different formats for the value string:
Google: vec4f_value = "[0.0, 1.0, 0.0, 1.0]"
Copilot: vec4_value = "0.5,2.0,4.0,0.0"
I had already tested both and none works.
Google says in the description:
To set a StelProperty that requires a Vec4f (a vector of 4 floats, typically used for RGBA colors or 4D coordinates) using the Stellarium Remote Control plugin, you must pass the data as a JSON-formatted string representing an array of four numbers to the /api/stelproperty/set endpoint.
API Method
Endpoint: POST /api/stelproperty/set
Parameters:
id: The string ID of the StelProperty (e.g., "SolarSystem.textColor").
value: A JSON array string "[r,g,b,a]" (e.g., "[1.0, 0.5, 0.0, 1.0]").
Example using curl
Example using Python
Key Details
Data Format: The value parameter must be a JSON array string containing four floats, specifically [x,y,z,w] or [r,g,b,a].
QVariant Logic: The Remote Control plugin converts this string input into the appropriate Vec4f type within Stellarium using QVariant logic.
10110111 commentedon Feb 19, 2026
It looks like there exists a conversion from
Vec4fto string (viaQVariant), but not backwards. So an attempt to write a property will write a zero vector.gzotti commentedon Feb 19, 2026
When adapting the Vec3d stuff for Qt6 scripting, I may have forgotten about the rare Vec4d (and Vec2d?), so (must check), a V4d class may have to be added.
10110111 commentedon Feb 19, 2026
This is not about scripting, it's about the RemoteControl POST API.
The issue begins in
StelProperty::setValue, where theQVariantis aQString, while the property isVec4f. In this caseQMetaType::canConvertwith these types returnsfalse.gzotti commentedon Feb 19, 2026
This means it is even older? (2016...) In any case, the solution most likely has parallels in Vec3d/V3d.
10110111 commentedon Feb 19, 2026
Not sure what you mean, the solution is as follows (and similarly for the rest of the types). Why the converters had been registered for to-string conversion but not back, I don't know.
Then the updated Python script works well:
Output:
10110111 commentedon Feb 19, 2026
Ah, I missed the comment after my added line. These converters were commented out in 7ce6ccd. No idea why though.
alex-w commentedon Feb 20, 2026
Probably some troubles was in scripting engine for Qt6 - @gzotti any comments please
gzotti commentedon Feb 20, 2026
Well it seems I tried to find out which solution worked in the attempt to use both scripting ways (Qt5/Qt6). It seems that I had already added the converter which @10110111 suggested, tried for something I wanted to achieve in QJEngine, found not helpful or not required at that time, so I commented it away "for now". If it is useful in this case and doesn't break Qt6 scripting, we can activate these lines again.
gzotti commentedon Feb 20, 2026
It works on Qt5 and Qt6, all tests run. Now I hope there is no other issue reactivated...
Allow Vec4 in RemoteControl API (Fix Stellarium#4780)
github-actions commentedon Mar 16, 2026
Hello @gchiozzi!
Please check the fresh version (development snapshot) of Stellarium:
https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot
github-actions commentedon Apr 5, 2026
Hello @gchiozzi!
Please check the latest stable version of Stellarium:
https://github.com/Stellarium/stellarium/releases/latest
gchiozzi commentedon Apr 17, 2026
Thanks!
I have installed stellarium 26.1 and now it works as expected.