RGB color values like [1,2,3] not working #111
-
Hello, I am referring to this documentation https://missionpinball.org/config/light_player/
The hex-values work fine, but the RGB values in [ ] I am not getting to work. I am getting this error
Does that work for someone or can someone spot what might be wrong? The part of my show config file looks like this
number 1 and 2 work fine. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
The log you sent and the code below are not the same. The log references a
value of "[120, 0, 0]". I am not sure if you put the quotes which broke
it, or if that is just how it is being handled in the logger. Can you send
the code that matches the error?
…On Thu, Sep 14, 2023 at 9:43 AM worldpeace-germany ***@***.***> wrote:
Hello,
I am referring to this documentation
https://missionpinball.org/config/light_player/
Set a color to this light. Color values may be a hex string (e.g. 22FFCC),
a list of RGB values (e.g. [50, 128, 206]),
The hex-values work fine, but the RGB values in [ ] I am not getting to
work. I am getting this error
raise ConfigFileError("Config validation error: Entry {} = \"{}\" is not valid. {}".format(
mpf.exceptions.config_file_error.ConfigFileError: Config File Error in ConfigValidator: Show "attract_light_show_opt5" >> Failed to load config player attract_light_show_opt5:lights with settings {'led_strip_0_led_7': {'color': [120, 0, 0], 'fade': '500ms', 'priority': 0}, 'led_strip_0_led_6': {'color': 'AABBCC', 'fade': '500ms'}, 'led_strip_0_led_5': {'color': 'AABBCC', 'fade': '500ms'}, 'led_strip_0_led_4': {'color': 'AABBCC', 'fade': '500ms'}, 'led_strip_0_led_3': {'color': 'AABBCC', 'fade': '500ms'}, 'led_strip_0_led_2': {'color': 'AABBCC', 'fade': '500ms'}, 'led_strip_0_led_1': {'color': 'AABBCC', 'fade': '500ms'}, 'led_strip_0_led_0': {'color': 'AABBCC', 'fade': '500ms'}} >> Config validation error: Entry light_player:light_player:color = "[120, 0, 0]" is not valid. List or dict are not string Error Code: CFE-ConfigValidator-5 (https://docs.missionpinball.org/en/0.56/logs/CFE-ConfigValidator-5.html)
Does that work for someone or can someone spot what might be wrong?
The part of my show config file looks like this
#show_version=5
- duration: 100ms
lights:
pre_1_post:
color: green
fade: 100ms
pre_2_post:
color: AABBCC
fade: 100ms
pre_3_post:
color: [100,0,0]
fade: 100ms
number 1 and 2 work fine.
Thanks!
—
Reply to this email directly, view it on GitHub
<#111>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AORJRKLTKPLZ6IYRQW4PBC3X2MJXPANCNFSM6AAAAAA4YHKQPU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
It is the logger, I just took the output from two different tests, anyways, here a matching example:
and the log
|
Beta Was this translation helpful? Give feedback.
-
I can look at it on my test environment tomorrow. But I would try adding quotes around it. The error is saying it’s getting a list or dictionary instead of a string as expected. If you add quotes “[100,100,100]” it will be picked up as a string and should get you past that error.Sent from my iPhoneOn Sep 14, 2023, at 12:33 PM, worldpeace-germany ***@***.***> wrote:
It is the logger, I just took the output from two different tests, anyways, here a matching example:
#show_version=5
- duration: 500ms
lights:
led_strip_0_led_0:
color: [255,255,255]
fade: 500ms
led_strip_0_led_1:
color: red
fade: 500ms
- duration: 500ms
lights:
led_strip_0_led_0:
color: red
fade: 500ms
led_strip_0_led_1:
color: blue
fade: 500ms
and the log
mpf.exceptions.config_file_error.ConfigFileError: Config File Error in ConfigValidator: Show "attract_light_show_opt6" >> Failed to load config player attract_light_show_opt6:lights with settings {'led_strip_0_led_0': {'color': [255, 255, 255], 'fade': '500ms', 'priority': 0}, 'led_strip_0_led_1': {'color': 'red', 'fade': '500ms'}} >> Config validation error: Entry light_player:light_player:color = "[255, 255, 255]" is not valid. List or dict are not string Error Code: CFE-ConfigValidator-5 (https://docs.missionpinball.org/en/0.56/logs/CFE-ConfigValidator-5.html)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I tried it again with "" and recognized that the log now doesn't show the "", so I got around this error ;-) and have the next error
I tried all kind of variations, quotes, no quotes, "," or ";", space around numbers, no spaces around number. Anyways, was a good idea to try. Happy to try other options I might not have thought about as well. |
Beta Was this translation helpful? Give feedback.
-
Okay I did some more testing, thinking that the show file is the issue and that this only works in a config file. So I created in my config.yaml
I tried it again with or without "", it gives very much the same error messages as in the show config file case. Then I tried in my config.yaml to use
This works fine and I can use the color "my_name" in my show. So may be that RGB notation only works for named colors. I would consider this a bug. Note, in the named_colors section I have not used quotes. |
Beta Was this translation helpful? Give feedback.
-
I was able to play around with it, and you are correct. The light_player only accepts a string, and thus when you are putting in you RGB arguments its saying that's a list (tuple) and that isn't allowed. I would defer to someone else, but allowing RGB entries on light_player and in shows could be breaking of other configs. That being said, I have code to parse the text, identify it as RGB values, strip the brackets and convert it just like a named value. This can be done, but its a question of if its worth the edge case to do it. Or in light_player add documentation that you can't use RGB, and if you want to do that, you need to created named_colors and reference them. |
Beta Was this translation helpful? Give feedback.
-
Hi, Thanks for cross checking. |
Beta Was this translation helpful? Give feedback.
I was able to play around with it, and you are correct. The light_player only accepts a string, and thus when you are putting in you RGB arguments its saying that's a list (tuple) and that isn't allowed. I would defer to someone else, but allowing RGB entries on light_player and in shows could be breaking of other configs.
That being said, I have code to parse the text, identify it as RGB values, strip the brackets and convert it just like a named value. This can be done, but its a question of if its worth the edge case to do it. Or in light_player add documentation that you can't use RGB, and if you want to do that, you need to created named_colors and reference them.