Jump to content
C4 Forums | Control4

Custom Buttons and Scenario Experience - pros/cons?


Recommended Posts

10 hours ago, zaphod said:

Why is there a icons-old folder?  What is it used for?

No idea, not normally used. I could hazard a guess and say it may be something for drivers with multiple feedback icons to retain a last 'state' icon for loading or maybe dumping unused status icon (ie maybe the RGB light experience driver or a shade driver that has multiple selectable options for 'types') but that is indeed just guess work.

10 hours ago, zaphod said:

And the device_lg and device_sm icons - are these just used by Composer or are they used anywhere else as well?

Just composer.

Link to comment
Share on other sites


1 hour ago, zaphod said:

Have a look inside the experience-button-scenario.c4z file that is in the C4 drivers file library.  There is a www/icons folder and a www/icons-old folder.

Likely the developer just renamed the /icons folder into /icons-old, and then put a new set of icons into /icons.

If they're not referred to in the .xml portion of the driver, they're not used by the experience button and could likely be deleted.

RyanE

 

Link to comment
Share on other sites

I have written the python code that totally automates this process and things were looking good.  I thought I did everything correctly but C4 doesn't want to accept my c4z files.  

It says 

Quote

Unable to add driver.
Reason: Broker: WebException

I am not sure what this means?  Maybe it doesn't like some of the parsing that I am doing in the XML file.  I seem to have all of the correct files in the correct directory structure.

Anyone know what this means?

Link to comment
Share on other sites

Here is the top of the file which is the odriver.xmlnly part that I have altered.  In this instance I am attempting to make a new driver using the Rolling Stones lips logo as the icon.

<devicedata>
	<!-- 
	If you are making your own driver then change the details below.  Note the date is in US format: Month/Day/Year
	-->
	<name>stones</name>
	<model>Scenario</model>
	<creator>Control4</creator>
	<created>03/07/2021 15:44</created>
	<modified>03/07/2021 15:44</modified>
	<!-- 
	Each time you modify the driver update the version number below.
	-->
	<version>12</version>
	<!-- 
	Modify the path in the display_icons section to match the name of your driver.
	So if you saved this driver as scenario-party-time.c4z replace stones with scenario-party-time
	Ensure you also add your own png icons to the icons/device folder named default_300.png, default_90.png and default_70.png
	Also add selected state icons as selected_300.png, selected_90.png and selected_70.png
	-->
	<capabilities>
		<navigator_display_option proxybindingid="5001">
			<display_icons>
				<Icon height="90" width="90">controller://driver/stones/icons/device/default_90.png</Icon>
				<Icon height="70" width="70">controller://driver/stones/icons/device/default_70.png</Icon>
				<Icon height="300" width="300">controller://driver/stones/icons/device/default_300.png</Icon>
				<Icon height="512" width="512">controller://driver/stones/icons/device/default_512.png</Icon>
				<Icon height="1024" width="1024">controller://driver/stones/icons/device/default_1024.png</Icon>
				<state id="Default">
					<Icon width="70" height="70">controller://driver/stones/icons/device/default_70.png</Icon>
					<Icon width="90" height="90">controller://driver/stones/icons/device/default_90.png</Icon>
					<Icon width="300" height="300">controller://driver/stones/icons/device/default_300.png</Icon>
					<Icon width="512" height="512">controller://driver/stones/icons/device/default_512.png</Icon>
					<Icon width="1024" height="1024">controller://driver/stones/icons/device/default_1024.png</Icon>
				</state>
				<state id="Selected">
					<Icon width="70" height="70">controller://driver/stones/icons/device/selected_70.png</Icon>
					<Icon width="90" height="90">controller://driver/stones/icons/device/selected_90.png</Icon>
					<Icon width="300" height="300">controller://driver/stones/icons/device/selected_300.png</Icon>
					<Icon width="512" height="512">controller://driver/stones/icons/device/selected_512.png</Icon>
					<Icon width="1024" height="1024">controller://driver/stones/icons/device/selected_1024.png</Icon>
				</state>
			</display_icons>
		</navigator_display_option>
	</capabilities>

Attached is the 90 pixel version of the file.  Maybe another possiblity is that it doesn't like the png file.  I also attached the entire c4z file.

stones.c4zdefault_90.png.cba58fb2621dba9243cf91a67f2edcdb.png

Link to comment
Share on other sites

I have got this working now.  I have created a python script that takes an image file and creates a button with a custom icon and inserts it into a c4z driver file.  It also alters the XML file.  I will probably start a new thread on this, but here is a screenshot to show a few examples. The red and black Rolling Stones logos show a default and selected version of a button.

Anybody else want to try it out?
image.thumb.png.91f13ee22e71ee69b916ab02c18e0f6b.pngimage.thumb.png.6b39e9e90582c1dcc097832438047c40.png

Link to comment
Share on other sites

This script produces a new .c4z drver file.  You need Composer Pro to add that to your system. If there are potentially a few different buttons that you might want I would suggest generating a few different drivers with this script and then have your dealer install the drivers.  Your dealer should be able to do this remotely in about two minutes.

Link to comment
Share on other sites

This just works to generate custom/experience buttons.  In theory you should be able to change the icons in any driver by swapping out the image files used for the icons and the references to them.  But I didn't want to be playing around with that in case it screws something up.  The code on github has a link to a youtube video that shows the process in detail if you want to give it a try.

Link to comment
Share on other sites

  • 9 months later...

Hi,

I had to change line 77 in order to get this to work with the current version of the driver:

    fin = open(file_name, "rt", errors="ignore")

Some extended characters were added into the description, custom quotes around "ON" and "OFF":

Driver Properties
Driver Version: Current driver version.
Current State: Current State of the Experience Button (On, Off)
On Name: The text value to display on list navigators when the experience button is set to “On”.
Off Name: The text value to display on list navigators when the experience button is set to “Off”.
Toggle State Each Time Selected: Toggle the state of the experience button when selected from a navigator (Yes), or do not toggle when selected (No).
On LED Color: The color to set a bound keypad button’s LED to when the experience button is set to “On” (Selected).
Off LED Color: The color to set a bound keypad button’s LED to when the experience button is set to “Off” (Default).

Rich-text character formatting that was preventing the read from succeeding.

RussellB

Ugh.. need to make some additional fixes because the OUTPUT XML was then not UTF8.

 

So I'm fixing the character set issue and defaulting to creating a driver called "uibutton_" + the name of the image.  I'll post a link to my github with the updated script.

Link to comment
Share on other sites

I've forked a branch of the python code here:

https://github.com/EnsignRutherford/C4driverbuilder

This version has added error handling, proper character conversion, and saves the final driver as "uibutton_<image name>.c4z", e.g. uibutton_christmas.c4z. 

I also added a Windows batch file to call, 'build.bat.'

Still doing some tweaking, like the batch file can process all images in a folder and create drivers for all of them.  I have some free time.  :)

Link to comment
Share on other sites

18 minutes ago, RussellB said:

I've forked a branch of the python code here:

https://github.com/EnsignRutherford/C4driverbuilder

This version has added error handling, proper character conversion, and saves the final driver as "uibutton_<image name>.c4z", e.g. uibutton_christmas.c4z. 

I also added a Windows batch file to call, 'build.bat.'

Still doing some tweaking, like the batch file can process all images in a folder and create drivers for all of them.  I have some free time.  :)

FYI, there's another similar project
Experience Button Generator:
https://dnosys.com/

Link to comment
Share on other sites

1 hour ago, RussellB said:

I've forked a branch of the python code here:

https://github.com/EnsignRutherford/C4driverbuilder

This version has added error handling, proper character conversion, and saves the final driver as "uibutton_<image name>.c4z", e.g. uibutton_christmas.c4z. 

I also added a Windows batch file to call, 'build.bat.'

Still doing some tweaking, like the batch file can process all images in a folder and create drivers for all of them.  I have some free time.  :)

Good job!  Does the batch file take the same parameters as the original python program - the unselected and selected image files?

Link to comment
Share on other sites

24 minutes ago, zaphod said:

Good job!  Does the batch file take the same parameters as the original python program - the unselected and selected image files?

build "name of default image" will build the driver.  if the "_selected" image is also in the folder it will be used otherwise ignored.

build without any parameter will build drivers for all the default images (non '_selected') and again use the _selected image if its there.  

I'm still doing some error handling and cleanup, but I just built 6 controls in one shot with it and it works great.

The programming behind the buttons is a little more elaborate.  They act like radio buttons as only one can be selected at a time.  If you deselect any button other than Normal Normal becomes enabled.  I think I'll rename it to Everyday or something like that.  Get the idea?

Screenshot_20220104-110431_Control4.jpg

Link to comment
Share on other sites

37 minutes ago, zaphod said:

This is actually way better than what I wrote with one exception - for some reason he does not automatically create the c4z file, you have to do that manually.

All roads lead to Munich.  :) 

I will be tweaking it over the next couple of days.  I posted an update to the build.bat to check if the required python packages are installed and if not install them.  Also the program now auto-downloads the template c4z file and deletes it afterwards.  I was annoyed to have to say no to overwriting the experience file every time I copied them to the Drivers folder.

I'm going to make a major change to update an EXISTING c4z if found.  So let's say you change the Christmas tree icons.  If found in the same folder it will update the version as well so it can be upgraded easily.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.