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

Weird Issue with strings from Texecom #20

Open
benepixx opened this issue Aug 1, 2020 · 2 comments
Open

Weird Issue with strings from Texecom #20

benepixx opened this issue Aug 1, 2020 · 2 comments

Comments

@benepixx
Copy link

benepixx commented Aug 1, 2020

So Sometimes (rarely) i'll get an accepted command which comes through as ZXXX1 or ZXXX0, but most of the time texecom is sending a pre-fix as follows:

[8/1/2020, 6:40:45 PM] [Texecom] IP data received: t4w"Z0061

[8/1/2020, 6:40:45 PM] [Texecom] Unknown string from Texecom: t4w"Z0061

Which results in it not understanding which zone it is, most of the time it begins with a t but the 2nd & 3rd character is variabale. eg. t.2"Z0051.

Any Ideas?

@benepixx
Copy link
Author

benepixx commented Aug 1, 2020

Just to follow up - when connected directly to the IP com in a TCP session the data looks like this?
t:³"Z0061
t; "Z0060
t<Ç"Z0061
t=•"Z0031
t>n"Z0060
t?ý"Z0061
t@Ú"Z0030

Ive looked at the code and this isn't expected behaviour. I changed "Startswith" "Z to "contains" which got me half way there but i can't chomp left as the characters aren't consistent. any ideas?

@benepixx
Copy link
Author

benepixx commented Aug 2, 2020

Fixed it: If anyone is interested/ has the same issue - I'm guessing to do with firmware of the Texecom Panel - here's the code you need to edit - i just changed the way the code processes the strings - this method should be backwards compatible too as it crops all the string including the Z using the between function.

function processData(data) {
// Received data is a zone update
if(S(data).contains('"Z')){

			// Extract the data from the serial line received
			var zone_data = Number(S(S(data).between('Z')).left(4).s);
			// Extract the zone number that is being updated
			var updated_zone = Number(S(S(data).between('Z')).left(3).s);
			// Is the zone active?
			var zone_active = S(zone_data).endsWith('1');

			platform.log("Zone update received for zone " + updated_zone + " active: " + zone_active);

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

1 participant