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

State not updated for Gate (io:DiscreteGateOpenerIOComponent) #40

Closed
francodutch opened this issue Jun 7, 2020 · 42 comments
Closed

State not updated for Gate (io:DiscreteGateOpenerIOComponent) #40

francodutch opened this issue Jun 7, 2020 · 42 comments
Labels

Comments

@francodutch
Copy link

francodutch commented Jun 7, 2020

Describe the bug
Not sure if bug in HA or in Tahoma, but when I open the gate from HA the status of cover correctly reflects the change. WHen the gate closes automatically after two minutes or when the gate is activated through the remote control however, the status change is not passed on to HA.

To Reproduce
Steps to reproduce the behaviour:

  1. change state of gate through cover.open_cover
  2. close gate using remote
  3. check status: still set to 'open'

Expected behavior
Status in HA should reflect physical status regardless of origin of command to open or close or stop the gate.

Environment (please complete the following information):

  • Home Assistant version: 0.110.4
  • Platform: cover

Device: io:DiscreteGateOpenerIOComponent

  • Model: [e.g. PositionableScreen, can be gathered from device list in HA]
  • Type: io:DiscreteGateOpenerIOComponent
{
	"creationTime": 1577640280000,
	"lastUpdateTime": 1577640280000,
	"label": "Gate",
	"deviceURL": "####",
	"shortcut": false,
	"controllableName": "io:DiscreteGateOpenerIOComponent",
	"definition": {
		"commands": [{
				"commandName": "close",
				"nparams": 0
			},
			{
				"commandName": "delayedStopIdentify",
				"nparams": 1
			},
			{
				"commandName": "getName",
				"nparams": 0
			},
			{
				"commandName": "identify",
				"nparams": 0
			},
			{
				"commandName": "open",
				"nparams": 0
			},
			{
				"commandName": "refreshPedestrianPosition",
				"nparams": 0
			},
			{
				"commandName": "setName",
				"nparams": 1
			},
			{
				"commandName": "setPedestrianPosition",
				"nparams": 0
			},
			{
				"commandName": "startIdentify",
				"nparams": 0
			},
			{
				"commandName": "stop",
				"nparams": 0
			},
			{
				"commandName": "stopIdentify",
				"nparams": 0
			},
			{
				"commandName": "wink",
				"nparams": 1
			}
		],
		"states": [{
				"type": "DataState",
				"qualifiedName": "core:NameState"
			},
			{
				"values": [
					"closed",
					"open",
					"pedestrian",
					"unknown"
				],
				"type": "DiscreteState",
				"qualifiedName": "core:OpenClosedPedestrianState"
			},
			{
				"type": "ContinuousState",
				"qualifiedName": "core:PedestrianPositionState"
			},
			{
				"type": "ContinuousState",
				"qualifiedName": "core:PriorityLockTimerState"
			},
			{
				"type": "ContinuousState",
				"qualifiedName": "core:RSSILevelState"
			},
			{
				"values": [
					"available",
					"unavailable"
				],
				"type": "DiscreteState",
				"qualifiedName": "core:StatusState"
			},
			{
				"values": [
					"comfortLevel1",
					"comfortLevel2",
					"comfortLevel3",
					"comfortLevel4",
					"environmentProtection",
					"humanProtection",
					"userLevel1",
					"userLevel2"
				],
				"type": "DiscreteState",
				"qualifiedName": "io:PriorityLockLevelState"
			},
			{
				"values": [
					"LSC",
					"SAAC",
					"SFC",
					"UPS",
					"externalGateway",
					"localUser",
					"myself",
					"rain",
					"security",
					"temperature",
					"timer",
					"user",
					"wind"
				],
				"type": "DiscreteState",
				"qualifiedName": "io:PriorityLockOriginatorState"
			}
		],
		"dataProperties": [{
			"value": "500",
			"qualifiedName": "core:identifyInterval"
		}],
		"widgetName": "DiscreteGateWithPedestrianPosition",
		"uiClass": "Gate",
		"qualifiedName": "io:DiscreteGateOpenerIOComponent",
		"type": "ACTUATOR"
	},
	"states": [{
			"name": "core:NameState",
			"type": 3,
			"value": "Gate"
		},
		{
			"name": "core:PriorityLockTimerState",
			"type": 1,
			"value": 0
		},
		{
			"name": "core:OpenClosedPedestrianState",
			"type": 3,
			"value": "closed"
		},
		{
			"name": "core:StatusState",
			"type": 3,
			"value": "available"
		},
		{
			"name": "core:RSSILevelState",
			"type": 2,
			"value": 50.0
		},
		{
			"name": "core:PedestrianPositionState",
			"type": 1,
			"value": 50
		}
	],
	"attributes": [

	],
	"available": true,
	"enabled": true,
	"placeOID": "####",
	"widget": "DiscreteGateWithPedestrianPosition",
	"type": 1,
	"oid": "####",
	"uiClass": "Gate"
},
@vlebourl
Copy link
Collaborator

vlebourl commented Jun 7, 2020

not sure whether it's relevant for the gate, but sometimes tahoma can send a command to a component but doesn't know it's state. this is the case for somfy's smart lock where I can open and close the lock through tahoma (independently of HA I mean) but the state in tahoma only reflects the last action done in tahoma, not the actual state of the lock. Can you confirm that the state of your gate is correctly displayed in your Tahoma dashboard?

@iMicknl
Copy link
Owner

iMicknl commented Jun 7, 2020

Next to that, in Home Assistant we poll the core:PedestrianPositionState for the position value (between 0 and 100) and we poll core:OpenClosedPedestrianState where we check if the status is closed.

I am not sure what the refreshPedestrianPosition does, maybe this needs to be called to update the core:PedestrianPositionState? If you have a look through the Tahoma app or website, is the right value reflected there? (if yes, is the right value reflected in Home Assistant afterwards?)

@francodutch
Copy link
Author

IN Tahoma the right value is only reflected after logging out and in again. So the interface remains stuck on the last position unless logout/login. This is different for the contact sensor (door open/closed sensor) which updates in real time in the Tahoma interface.

@iMicknl iMicknl changed the title state not updated when gate actioned outside Tahoma State not updated for Gate (io:DiscreteGateOpenerIOComponent) Jun 9, 2020
@iMicknl
Copy link
Owner

iMicknl commented Jun 9, 2020

@francodutch could you give the following branch a try? https://github.com/iMicknl/ha-tahoma/tree/fix_40. Before every update, it will call the refreshPedestrianPosition for now.

@francodutch
Copy link
Author

@iMicknl happy to but How? Just copying the repository probably not enough...do I need to deleted the integration and do a new one?

@vlebourl
Copy link
Collaborator

I think that if you replace the tahoma directory in the custom_components folder by the one in the said branch, you don't have to remove the integration, just restart HA to load the new version.

@github-actions
Copy link

'There hasn't been any activity on this issue recently. Is this issue still present?
Please make sure to update to the latest Home Assistant version and version of this integration to see if that solves the issue. Let us know if that works for you by adding a comment 👍.
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.'

@iMicknl
Copy link
Owner

iMicknl commented Sep 1, 2020

@francodutch could you give https://github.com/iMicknl/ha-tahoma/archive/feature/add_refresh_states_service.zip a try? You can unzip this file and place the tahoma folder in your custom_components folder. Best is to first remove the old one, to make sure you don't have any conflicts.

This will add a new service call named tahoma.refresh_states. Calling this service should trigger an update within 30 seconds (or less, based on your configured update interval). Could you give it a try? We will investigate better solutions in the future in #167.

@francodutch
Copy link
Author

will give it a try. How would it work though if I want an externally triggered event (ie use remote control to open gate) to be detected by HA?

@iMicknl
Copy link
Owner

iMicknl commented Sep 1, 2020

That should already work! You could first give it a try, to see if any change outside Home Assistant is reflected within a minute after the gate is fully open / closed.

If that doesn't work yet, call the tahoma.refresh_states and see if it does update to the right state within 30 seconds.

@francodutch
Copy link
Author

sure I can test that, but unless I am missing something, in a real life situation rather than in testing, I don't know when to trigger the service to update the status... what am I missing?

@iMicknl
Copy link
Owner

iMicknl commented Sep 1, 2020

@francodutch in the future, this could be automated, like the automated polling we do now. However, I would need to understand first if this works in your scenario.

And even as a workaround, you could create an automation to automatically call this service every minute.

@francodutch
Copy link
Author

got it. I will test it.

@francodutch
Copy link
Author

francodutch commented Sep 2, 2020

@iMicknl It works. I had one instance where HA actually detected a gate opening externally triggered, without using the state update service, but i haven't been able to reproduce that. However the service works after20-30 secs or so. Is there anywhere that update frequency can be changed?

@iMicknl
Copy link
Owner

iMicknl commented Sep 21, 2020

@francodutch could you give the latest version a try? (https://github.com/iMicknl/ha-tahoma/archive/feature/refresh_states.zip). By default, the refresh state interval is every hour, but you could put it on a lower value if you want.

And when you call the tahoma.refresh_states service manually, it should be way quicker than 20-30 seconds as well.

@francodutch
Copy link
Author

francodutch commented Sep 25, 2020

@iMicknl I will - just having issues now with the range of the radio reception by the Tahoma box of my izymo and gate radios...need to fix that first to have reliable test results...I did notice that despite the gate having been open for a while, it was marked closed in HA. Only after calling the state update service did it reflect 'open'. In the Tahoma native interface there's a '?' on the gate icon...

@francodutch
Copy link
Author

HI there has the tahoma.refresh_states service been removed? I'm having issues again with my gate showing "open" when it has been automatically closed by the 2 minute timer on the gate-control box.

@iMicknl
Copy link
Owner

iMicknl commented Jan 12, 2021

@francodutch sorry, I totally missed your reply. Are you still using the integration and facing these issues?

@francodutch
Copy link
Author

Hi Mick yes I love it I use it daily and it works reliably with one exception, which is that when the gate closes automatically (gate controller setting) 2 min after it opens,the status in HA remains 'open' for hours. It somehow doesn't detect that the state has changed to closed. You've been doing so much work on this integration...THANKS!!

@vlebourl
Copy link
Collaborator

Does the state update if you run the service tahoma.execute_command with refreshPedestrianPosition after it automatically closed?

@iMicknl
Copy link
Owner

iMicknl commented Jan 16, 2021

Does the state update if you run the service tahoma.execute_command with refreshPedestrianPosition after it automatically closed?

Good one. Or if you login to tahomalink.com. I guess they call the refreshAllStates to retrieve it.

@francodutch
Copy link
Author

@vlebourl @iMicknl no it doesn't u[date. Just to make sure I'm calling the service the correct way, see the attached screenshot. When I log on to Tahomalink the state is reflected correctly as closed. After doing that, the state in HA updates to 'closed'.
Screen Shot 2021-01-17 at 18 35 33

@vlebourl
Copy link
Collaborator

One way to understand what happens is to open the dev tools of your browser and monitor network activities while you log into tahomalink and the gate updates itself. You should see a bunch of fetch events (1 per second) and in the middle, the event that causes the refresh. I have this kind of behaviour with the smart thermostat. I'll try to make a capture of my browser if you need it to understand what I mean.

@francodutch
Copy link
Author

tx. by the way here is what I captured from the logs, after running the refresh. DOn't think it's of much use but just in case: https://paste.ubuntu.com/p/jxBZ9yvdTr/

@iMicknl
Copy link
Owner

iMicknl commented Jan 17, 2021

@francodutch could you try the following version; https://github.com/iMicknl/ha-tahoma/archive/feature/add_refresh_states_service.zip.

The tahoma.refresh_states service has been added. Calling this service should give the same results as the login via tahomalink.com.

@francodutch
Copy link
Author

@iMicknl just by copying the contents of /ha-tahoma-feature-add_refresh_states_service 2/custom_components from the zip file into /Volumes/config/custom_components on the rpi? none of the files in the higher dirs are needed, correct?

@iMicknl
Copy link
Owner

iMicknl commented Jan 17, 2021

@francodutch indeed. Unzip the downloaded file and place custom_components/tahoma in your custom_components folder. You should overwrite the current tahoma folder.

@francodutch
Copy link
Author

done and tested, but result is still the same. @vlebourl if you have a screenshot or indication of where to look in the dev tools that would be super

@iMicknl
Copy link
Owner

iMicknl commented Jan 17, 2021

Could you share your log as well please? I would like to understand if the call did work.

@vlebourl
Copy link
Collaborator

done and tested, but result is still the same. @vlebourl if you have a screenshot or indication of where to look in the dev tools that would be super

Sorry, don't have time tonight...

@francodutch
Copy link
Author

@iMicknl @vlebourl I have captured the log after running the command and then after logging in to Tahomalink: https://paste.ubuntu.com/p/Fv2wsFzJdy/

@iMicknl
Copy link
Owner

iMicknl commented Jan 18, 2021

@francodutch I don't see the call to tahoma.refresh_states. Did you call that via HA?

@francodutch
Copy link
Author

francodutch commented Jan 18, 2021

Yes, via developer tools. I added a screenshot in one of the earlier messages.

@iMicknl
Copy link
Owner

iMicknl commented Jan 18, 2021

Yes, via developer tools. I added a screenshot in one of the earlier messages.

That screenshot mentions execute_command and refreshPedestrationPosition, that is a different call. You need this one:

Screen Shot 2021-01-18 at 09 35 07

By the way, I did share an older version of the integration by accident. The best version for this feature to use is https://github.com/iMicknl/ha-tahoma/archive/feature/refresh_states.zip.

@vlebourl
Copy link
Collaborator

done and tested, but result is still the same. @vlebourl if you have a screenshot or indication of where to look in the dev tools that would be super

Hey, I've prepared a capture, but there are some private info I'd rather not see public on github. Can you join our discord https://discord.gg/nwH4sVKQ so that I can pm it to you?

@francodutch
Copy link
Author

ok. @iMicknl Tahoma.refresh_states does the trick and updates the state to "closed" after the gate has auto-closed. Question is, what is a reasonable frequency (or even: logic?) to call this service to not overload the system? @vlebourl thanks for the video but I couldn't find any 'internal" request nor the request detail (only the header). Also, the state resets properly when I log in to Tahoma Link, I don't even have to select the gate device.

@iMicknl
Copy link
Owner

iMicknl commented Jan 18, 2021

ok. @iMicknl Tahoma.refresh_states does the trick and updates the state to "closed" after the gate has auto-closed. Question is, what is a reasonable frequency (or even: logic?) to call this service to not overload the system? @vlebourl thanks for the video but I couldn't find any 'internal" request nor the request detail (only the header). Also, the state resets properly when I log in to Tahoma Link, I don't even have to select the gate device.

Great to hear! To be honest, I don't know yet. This is also the reason that this feature hasn't been released officially in this integration (yet). By default, it will call this service automatically every hour. (see Integrations -> Devices -> Somfy Tahoma -> Options), however in your case it could be wise to create an automation that calls this refresh_states service 5 minutes after a state change of your gate.

@francodutch
Copy link
Author

cool, thanks for the help. Does that mean though that next time I upgrade to a new version I will lose the refresh_states service?

@iMicknl
Copy link
Owner

iMicknl commented Jan 18, 2021

cool, thanks for the help. Does that mean though that next time I upgrade to a new version I will lose the refresh_states service?

Yes. I will see if we can merge this version soon, so that it is included in new released versions.

@francodutch
Copy link
Author

it's a very workable solution now. I just test on the gate being open for 2 min (plus a few seconds margin) then run the refresh_states service.

@iMicknl
Copy link
Owner

iMicknl commented Jan 18, 2021

@francodutch in case you have created an automation (or something similar), feel free to share the config here. Would be good to document it as well.

@francodutch
Copy link
Author

ultra simple...no magic! https://paste.ubuntu.com/p/DZ256Jz3z9/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants