homey-arduino-library icon indicating copy to clipboard operation
homey-arduino-library copied to clipboard

Using the same capability more than once

Open rnldnkp opened this issue 7 years ago • 21 comments

For a normal app you state:

Using the same capability more than once

In certain cases it might occur that a device should use a capability more than once. An example would be a device with an outside and inside temperature sensor. Simply append a dot followed by an identifier after the capability string during in your driver, e.g. measure_temperature.inside & measure_temperature.outside.

https://apps.developer.athom.com/tutorial-Drivers-Capabilities.html

However, this does not seem to work with this library. the ".name" gets ignored and just overwrites the first capability type.

As far as I can see in the documentation there is no other way to name a capability on the Arduino. The example codes do not have this challenge since all of them are unique.

Could you explain if it should work with this library or would this be a feature request?

Thanks

rnldnkp avatar Jan 19 '18 20:01 rnldnkp

any news on this issue?

(i just run into this problem when i was coding for my sonoff dual, which has two onoff capability)

gn0st1c avatar Mar 17 '18 12:03 gn0st1c

I am currently busy with my graduation internship, because of this I do not have time to look any further into the issue you are experiencing.

(My internship at Athom has ended over a month ago...)

renzenicolai avatar Mar 23 '18 22:03 renzenicolai

Same here,
Homey.addCapability("measure_temperature.outside");

is not working. Could someone from Athom fix this?

magtimmermans avatar Apr 02 '18 14:04 magtimmermans

This would be a useful feature for better integration with home security systems. For example, DSC security systems support multiple partitions, each of which has its own set of status states (armed/disarmed/triggered, etc) that would need to be mapped to the homealarm_state capability.

At the moment, it seems that only one partition can be exposed to Homey using this library.

taligentx avatar Jul 09 '18 19:07 taligentx

This needs a fix! I have it all working in SmartThings and this is one og two issues stopping me from a 100% conversion. I have four relays needed to be controlled as four different switches. It is controlling a ventilation system.

prj84 avatar Aug 04 '18 17:08 prj84

@jeroenvollenbrock could you assign someone who currently works for Athom? Renze is no longer available he says and he removed his assignment.

Thanks

rnldnkp avatar Aug 04 '18 17:08 rnldnkp

the problem is when you define a capability/action it creates a function and web endpoint with that name. since identifier can only consist of letters, digits or underscore, using anything else (dot or space etc) causes the issue.

my simply/fast hack solution was use the upper case X instead of . (dot). then when needed replace it back;

	s->print(",\"api\":[");
	HomeyFunction *item = firstHomeyFunction;
	while (item != NULL) {
		s->print("{\"name\":\"");
		String fooname = item->name;
		fooname.replace("X", ".");
		s->print(fooname);

...

		for (;position<_request.endpoint.length();position++) {
			if (_request.endpoint.charAt(position) == '/') break;
		}
		String type = _request.endpoint.substring(0, position);
		String name = _request.endpoint.substring(position+1);
		name.replace(".","X");

...

	/* Execute request */
	CLIENT_TYPE client;
	if (client.connect(_master_host, _master_port)) {
		String fooname = name;
		fooname.replace("X", ".");

		client.print("POST /emit/");
		client.print(evType);
		client.print('/');
		client.print(fooname);

gn0st1c avatar Aug 06 '18 20:08 gn0st1c

@gn0st1c can you confirm where you made these changes so I can copy?

konradwalsh avatar Aug 10 '18 07:08 konradwalsh

@konradwalsh: sorry, i didn't get notice for the mention. (maybe because you edited the comment). i'll fork these repos and apply my patches. i'll let you know when i'm done.

cheers,

gn0st1c avatar Aug 11 '18 10:08 gn0st1c

@konradwalsh : you can get it from https://github.com/gn0st1c

gn0st1c avatar Aug 11 '18 10:08 gn0st1c

@gn0st1c very kind of you.. thanks

konradwalsh avatar Aug 11 '18 19:08 konradwalsh

Hi! I tried @gn0st1c fork, but is still not able to add multiple capabillities. Has anyone else had success?

prj84 avatar Oct 03 '18 13:10 prj84

Would love to get this working, has anyone had any luck?

Swiftnesses avatar Nov 25 '18 17:11 Swiftnesses

@gn0st1c I tried your changes to the homey.cpp file but had no luck? Any advice, I noticed your fork is no longer there?

Swiftnesses avatar Nov 25 '18 19:11 Swiftnesses

Earth to @WeeJeWel?

Swiftnesses avatar Feb 12 '19 19:02 Swiftnesses

Are any updates on this?

guestus avatar Nov 26 '19 07:11 guestus

Hey guys, we cannot give support on this project, as it's aimed towards hobbyists. All code is open source so you're free to fork is as you'd like.

WeeJeWel avatar Nov 26 '19 08:11 WeeJeWel

Hey guys, we cannot give support on this project, as it's aimed towards hobbyists. All code is open source so you're free to fork is as you'd like.

OK, understood... but if this one thing was fixed..

we clearly dont know how to and the early post seems to suggest how to

https://github.com/athombv/homey-arduino-library/issues/41#issuecomment-410845129

konradwalsh avatar Nov 26 '19 08:11 konradwalsh

Hey guys, we cannot give support on this project, as it's aimed towards hobbyists. All code is open source so you're free to fork is as you'd like.

I thought the whole homey ecosystem is aimed towards hobbyists.

psy0rz avatar Mar 14 '20 11:03 psy0rz

Im also facing this problem. Fix of @gn0st1c does not work, or i implemented it wrongly.

Can we get a fix for this? want to make a Pool controller but need 3 temp sensors and 2 relay sockets for that.

luccie007 avatar May 29 '20 15:05 luccie007

Hi, is there still nobody who can fix this? Tried the fix of @gn0st1c from the fork of @guestus but it's not working for me. I would like to have 2 temp sensors and a temp difference on 1 arduino.

KRiZ-R avatar Mar 19 '22 22:03 KRiZ-R