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

Blind controls are not working, but found a way to make them work. #14

Open
cobaltjeh opened this issue Sep 11, 2022 · 8 comments
Open

Comments

@cobaltjeh
Copy link

cobaltjeh commented Sep 11, 2022

So the blinds are not working, and some relays are having the same problem.
Debugging the web-interface from eNet I found out that the wrong uid is being called. For my blinds the "InputDeviceFunctions" is being called using the FT_INBA.SAPBP key. So every device has their own config and way of being called.

Luckily the interface can help us finding the right parameter.
On the server there is a xml file "https://192.168.10.90/ibnclient/conf/IbnConfig.xml?v=6.14.0&m=GIRA"

In this file there is a full list of all the devices. And more important a description of the channels.

And a language file "https://192.168.10.90/ibnclient/languages/catalog_language_en.properties?v=6.14.0&m=GIRA" that contains all the translations.
So my shutter controller device type is: "DVT_SJA1"
In this file: "https://192.168.10.90/ibnclient/languages/manufacturer_language_en.properties?v=6.14.0&m=GIRA"
I can find this line: DVT_SJA1=Top unit, blinds control button, 1-gang

In the IbnConfig I can find the following information for this device:

<!-- DVT_SJA1 -->
		<devicetype id="DVT_SJA1">
			<updateDuration firmware="900" postProcessing="30" />
			<parameterclasses/>
			<dialogs>
				<infodialog>
					<tabs>
						<tab title="DIALOG_CONNECTION">
							<!-- Anzeige Verbindungsübersicht -->
							<deviceConnections placeholder="true" />
						</tab>
						<tab title="DIALOG_MAIN">
							<!-- Gerätedaten: Name, Bestell-Nr -->
							<deviceData placeholder="true" />
							<line placeholder="true" />
							<!-- Steuerung der Hauptfunktion jeden Kanals -->
							<mainFunctionControlGroup placeholder="true" />
						</tab>
						<tab title="DIALOG_INFO">
							<!-- Installationsort/-bereich -->
							<installationData placeholder="true" />
							<line placeholder="true" />
							<!-- Artikelnummer, Produktgruppenkennung, Bauform, Auslaufkennzeichnung, -->
							<articleData placeholder="true" />
							<!-- Seriennummer -->
							<serialNo placeholder="true" />
							<!-- Parameterstatus -->
							<parameterStatus placeholder="true" />
							<!-- SW-, HW-Version -->
							<versionData placeholder="true" />
						</tab>
						<tab title="DIALOG_LINKS">
							<!-- div. Links zu Dokumenten -->
						</tab>
						<tab title="DIALOG_NOTES">
							<infoNotes placeholder="true" />
						</tab>
						<tab title="DIALOG_ERROR">
							<errorMemory placeholder="true" />
						</tab>
					</tabs>
				</infodialog>
				<parameterdialog>
					<tabs>
						<tab title="CHANNEL_CONFIGURATION">
							<channelconfig placeholder="true" />
						</tab>
						<tab title="SETTINGS_BASE">
							<!-- keine Einstellungen (Tab wird nicht angezeigt) -->
						</tab>
						<tab title="SETTINGS_EXTENDED">
							<!-- System -->
							<parameter id="PT_SJA1_LEARN_MODE_ENABLE" readonly="false" editControl="SHOW_ON_TO_OFF_INFO" />
							<parameter id="PT_SJA1_ENABLE_EXTENSION" readonly="false" />
							<line placeholder="true" />
							<!-- CONTROL: Links zu unbekannten Geräten löschen -->
							<buttonRemoveUnknownLinks placeholder="true" />
							<line placeholder="true" />
							<!-- CONTROL: Gerät lokalisieren -->
							<buttonDeviceLocalize placeholder="true" />
							<!-- CONTROL: Gerät wiederherstellen -->
							<buttonDeviceRepair placeholder="true" />
							<!-- CONTROL: Gerät zurücksetzen -->
							<buttonDeviceReset placeholder="true" />
						</tab>
					</tabs>
				</parameterdialog>
			</dialogs>
		</devicetype>

In the device info returned from the api we see the "channelTypeID": "CT_1F03".

We can then locate this parameter in the IbnConfig to find out the correct settings to control this channel:"

<!-- Kanal INBA (CT_1F03) -->
		<channeltype id="CT_1F03">
			<!-- Hier direkt die 'wesentlichen' Parameter Klasse II definieren -->
			<channeltype_secondClassParameter id="PT_INBA.OPMODE" />
			<!-- Hier direkt die 'wesentlichen' Parameter Klasse III definieren -->
			<channeltype_thirdClassParameter id="PT_INBA.APPLICATION_MODE_DUMMY" lockedByInactivePlanUsage="true" /> <!-- Application Mode (Dummy) -->
			<!-- Hier direkt die Haupt-'Steuer'Funktionen angeben, die auf der ersten Info-Dialog Seite eingeblendet werden -->
			<channeltype_mainFunctionControlGroup>
				<controlgroup>
					<control id="FT_INBA.SAPBP" />
					<info id="FT_INBA.CAPBP" />
				</controlgroup>
			</channeltype_mainFunctionControlGroup>
			<!-- Jetzt die Definition für die Parameter -->
			<dialogs>
				<infodialog>
					<tabs>
						<tab title="DIALOG_CHANNEL_CONTROL">
							<controlgroup>
								<control id="FT_INBA.SAPBP" />
								<info id="FT_INBA.CAPBP" />
							</controlgroup>
							<controlgroup>
								<control id="FT_INBA.SAPSP" />
								<info id="FT_INBA.CAPSP" />
							</controlgroup>
							<controlgroup>
								<info id="FT_INBA.IFOS" />
							</controlgroup>
							<controlgroup>
								<info id="FT_INBA.IALFS" />
							</controlgroup>
						</tab>
						<tab title="DIALOG_CHANNEL_INFO">
							<effectData placeholder="true" />
							<line placeholder="true" />
							<!-- Auflistung, wo der Kanal überall vorkommt -->
							<referedInPlans placeholder="true" />
							<line placeholder="true" />
							<!-- TODO: entweder alle aufführen oder ID abschneiden -->
							<parameter id="PT_*_INFO_ACTIVE_COUNTER_RESETABLE_1*" readonly="true" />
							<parameter id="PT_*_INFO_ACTIVE_COUNTER_RESETABLE_2*" readonly="true" />
						</tab>
					</tabs>
				</infodialog>
				<parameterdialog>
					<tabs>
						<tab title="SETTINGS_BASE">
							<!-- Load -->
							<parameter id="PT_*_INFO_ACTIVE_COUNTER_RESETABLE_1*" readonly="false" editControl="RESET_BUTTON" />
							<parameter id="PT_*_INFO_ACTIVE_COUNTER_RESETABLE_2*" readonly="false" editControl="RESET_BUTTON" />
						</tab>
						<tab title="SETTINGS_EXTENDED">
							<!-- System -->
							<parameter id="PT_INBA.OPMODE" readonly="false" />
							<parameter id="PT_INBA.LME" readonly="false" />
							<parameter id="PT_INBA.MCE" readonly="false" />
							<line placeholder="true" />
							<!-- Load -->
							<parameter id="PT_INBA.MUDT" readonly="false" />
							<parameter id="PT_INBA.MSMT" readonly="false" />
							<parameter id="PT_INBA.RPT" readonly="false" />
							<parameter id="PT_INBA.EIM" readonly="false" />
							<line placeholder="true" />
							<!-- Behaviour -->
							<parameter id="PT_INBA.BMPU" readonly="false" />
							<parameter id="PT_INBA.BPMPU" readonly="false" />
							<parameter id="PT_INBA.SPMPU" readonly="false" />
							<parameter id="PT_INBA.BUL" readonly="false" />
							<parameter id="PT_INBA.SLME" readonly="false" />
							<parameter id="PT_INBA.PSN[42]" readonly="false" />
							<parameter id="PT_INBA.SCV1[42]" readonly="false" />
							<parameter id="PT_INBA.SCV2[42]" readonly="false" />
							<parameter id="PT_INBA.SCV1[43]" readonly="false" />
							<parameter id="PT_INBA.SCV2[43]" readonly="false" />
							<parameter id="PT_INBA.PSN[44]" readonly="false" />
							<parameter id="PT_INBA.SCV1[44]" readonly="false" />
							<parameter id="PT_INBA.SCV2[44]" readonly="false" />
							<parameter id="PT_INBA.SCV1[45]" readonly="false" />
							<parameter id="PT_INBA.SCV2[45]" readonly="false" />
							<parameter id="PT_INBA.PSN[46]" readonly="false" />
							<parameter id="PT_INBA.SCV1[46]" readonly="false" />
							<parameter id="PT_INBA.SCV2[46]" readonly="false" />
							<parameter id="PT_INBA.SCV1[47]" readonly="false" />
							<parameter id="PT_INBA.SCV2[47]" readonly="false" />
							<parameter id="PT_INBA.PSN[48]" readonly="false" />
							<parameter id="PT_INBA.SCV1[48]" readonly="false" />
							<parameter id="PT_INBA.SCV2[48]" readonly="false" />
							<parameter id="PT_INBA.SCV1[49]" readonly="false" />
							<parameter id="PT_INBA.SCV2[49]" readonly="false" />
							<parameter id="PT_INBA.PSN[50]" readonly="false" />
							<parameter id="PT_INBA.SCV1[50]" readonly="false" />
							<parameter id="PT_INBA.SCV2[50]" readonly="false" />
							<parameter id="PT_INBA.SCV1[51]" readonly="false" />
							<parameter id="PT_INBA.SCV2[51]" readonly="false" />
						</tab>
					</tabs>
				</parameterdialog>
			</dialogs>
		</channeltype>

With this information we know how to control the channel:

<tab title="DIALOG_CHANNEL_CONTROL">
			<controlgroup>
								<control id="FT_INBA.SAPBP" />
								<info id="FT_INBA.CAPBP" />
							</controlgroup>
							<controlgroup>
								<control id="FT_INBA.SAPSP" />
								<info id="FT_INBA.CAPSP" />
							</controlgroup>
							<controlgroup>
								<info id="FT_INBA.IFOS" />
							</controlgroup>
							<controlgroup>
								<info id="FT_INBA.IALFS" />
							</controlgroup>
						</tab>

So we need the parameters FT_INBA.SAPBP which translates to: SAPBP=Blind/shutter height
IFOS=Feedback, restraint
AND
IALFS=Feedback, lock-out protection

So yeah, it is going to be a lot of work, but with these xml files, we should be able to automate and make every eNet device work.
With recent announcement of integration into Mediola, I have lost every faith in ever getting a proper integration. So I think I will start working on this, but it will take some time.

@cobaltjeh cobaltjeh changed the title Blind controls are not working. Blind controls are not working, but found a way to make them work. Sep 11, 2022
@mnordseth
Copy link
Owner

Thanks for digging into this. I have not seen these xml files, I merely started out reverse engineering how to control each device from the web interface.

It seems like we for each channeltype can look at channeltype_mainFunctionControlGroup and the control id to map how to control each device, and the corresponding info id on how to read status. I will test it.

@cobaltjeh
Copy link
Author

Sorry for the second update, was mixing accounts.

Yes mainFunctionControlGroup should work. But you still have to format the request according the outputDeviceFunction call.
But that format can be retrieved by calling the info field. In this case the (and seems to be generic for most devices. Either on/off or 0-100 parameter)

Sadly I am away the next 2 weeks, but after that I also will try to do some coding.

Keep in mind that I am using a Gira server, but the firmware should be the same except some naming differences with the Jung server.

@mnordseth
Copy link
Owner

Hi Jan, I have recently spent quite some time rewriting this as a native integration, and your device will show up (for now as a light), but the blind height is contrallable. Head over to https://github.com/mnordseth/enet-homeassistant to test it.

@cobaltjeh
Copy link
Author

Hi Magnus,

That is quite interessting, I spend quite some time rewriting the code into an appdaemon home assistant service. So far that is working flawlesly. And blinds show up as blinds, and up-down is working as expected. Open and closed is the other way around with home assistant and blinds. 100 is 100% open and not 100% closed as I would expect it to be.

But I must say that I have been replacing some of my enet components with tasmota and zigbee devices. The enet devices are are selling good on the second hand market due to supply shortages and un-availability of stock. Sold like 3 enet switches and bought like 10+ zigbee switches back for the same amount.

I will try to commit a branch of my changes in the next days, comparing the code is always usefull, and perhaps certain blocks can be re-used. And it would not hurt to test your code as well.

Still the solution isn't great due to the polling, when I turn on my lamps there always is a delay before my touchscreen in the livingroom is updated. For now I will make due.

@mnordseth
Copy link
Owner

I found a way to subscribe for events from the enet server, and has gotten away from the polling. Events from buttons and remotes are instantaneous, while there is a slight delay for events from the actuators. But still a huge improvement from the polling.

@cobaltjeh
Copy link
Author

That is a huge improvement indeed, I see you have hard-coded the device types. I made a script that reads the config from the server. But since Enet device updates are quire rare, hard-coded seems to be more easy.

I will test and check the code, and see if I can include my code that is registering the correct home assistant type.
Haven't worked with HACS before, can you also 'live' debug with VS code server on HA?

One thing I was wanting to implement in the future is changing parameters. For example the dimmers have a det default dimming value. If I can automate that, I can lower the default setting at night.

@mnordseth
Copy link
Owner

Yes, the repository is configured with a devcontainer in VS code, that allows you to do live debugging. If you open the repo in VS Code it should automatically launch it in the devcontainer. You run it with "Run task" and can then attach the debugger.

@nestorix1343
Copy link

I found a way to subscribe for events from the enet server, and has gotten away from the polling. Events from buttons and remotes are instantaneous, while there is a slight delay for events from the actuators. But still a huge improvement from the polling.

That would be really neat ... can't wait for the changes and test them.

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

3 participants