[Homeyduino] E-paper for Homey

indeed, I see now. let me also check that part. maybe original device had less fields and it fits at that time.

found it https://github.com/PeterEIER/com.athom.homeyduinoSDK3/blob/master/node_modules/homey-arduino/lib/ArduinoDiscovery.js#L136

Yes, it should wait until it can fully parse the data before it continues processing it.

Version 1.2.3? Had the same downgraded to 1.2.2 problem solved.

another ‘google search’ champion :stuck_out_tongue_winking_eye:

1 Like

yes, I guess you have less data or caps on 1.22 so smaller packet size and fits in 1. we need to fix this else we are limited in any future development.

more github , you can see who forked the athom one. total 5

Current functionality is fine for me, and as such I couldn’t care less about this bug :wink:

Yes, years ago… Athom confirmed that they will update Homeyduino, so no need any more for forking / pull requests.

It is time for a separate “[APP] [PRO] Homeyduino” topic, we are polluting the e-paper topic imho.

quick fix. At least we can add more stuff now else we are restricted, hit our limit on our E-paper and we need to try to stay under 1460 bytes as UDP packet.

on esp32, libraries/WiFi/src/WiFiUdp.cpp
UDP MTU is set to 1500
WiFiUdp is 1460 → this is the size I see on 1st packet , 2nd = 160.

UDP has no built in ordering, and UDP packets cannot be guaranteed to be properly reconstructed if fragmented. There is a protocol called TCP that provides exactly what you want!

So did this for now on

do tcp when udp json parsing goes wrong.

	poll(ip, callback) {
		this._debug("Polling device "+ip+" over TCP...");
		let host = {"address":ip, "port":46639};
		request.get('http://'+ip+':'+46639+'/', {timeout: 5000}, (err, response, body) => {
			if (err) console.log("poll rq err",err);
			if (err) return callback(err, null);
			this._onServerMessage( body, host, function (err, res) {
				if (err) console.log("poll osm err",err);
				if (err) return callback(err, null);
				if (err) console.log("poll rq ok",res);
				return callback(null, res);
			});
		});
	}

	_onServerMessage( message, host, callback ) {
		if (typeof callback == 'undefined') callback = function(){};

		message = message.toString();
		// console.log("msg: " + message);

		var opts = null;

		try {
			opts = JSON.parse(message);
		} catch(e) {
            console.log("error parsing");

			return this.poll(host.address, callback); 
			// this._debug("Received corrupt data from "+host.address+", ignoring packet.");
			// this._debug("DUMP:",message);
			// return callback("Received corrupt data!", null);
		}
        console.log("done, got json data");
		opts.address = host.address;
		opts.port = host.port;

final fix is we need a buffer or queue until we have a good json.

Let’s hope Athom reads this thread… likely not… raise a PR on their Homeyduino Github.

probably never, I think there is now a new policy that you can have the same app twice, with a different name off course.

thanks for converting the app to sdk v3, this is my last change about the app in this channel.

but if you want to change your device settings like enable polling or change ip without doing your flows again, you have to do this on your device.

Raise a PR with Athom to make them aware.

Yes, my E-paper display is operational. Wasn’t hard to do.
Most time was taken by the fact I had to reanimate an old windows laptop, because my Mac also couldn’t update the ESP32 because of the ESPTOOL.PY bug. :smirk:

@sebyldino is it possible to set font size (or to make that possible)? Especially of the value’s in the zone’s. I would like to be able to read the display without reading glases :disguised_face:

I managed to upload on iMac. (M1 V13.1).
Lowered the upload speed to 115200 according to this: esp tool fails with exception on Mac M1 (ESPTOOL-563) · Issue #806 · espressif/esptool · GitHub
Now ESPTOOL.PY error message is gone :slight_smile:

3 Likes

@sebyldino Hey, I got some weird text value issue. I want to push “0 W” as text after some “X w” value but if I do that, the value is not updated on the device. if X is a different number it is updated and I see it on the e-paper but if value is back to 0 W it is not and stays on latest X value.

it looks like with #somecap and its value as 0 is ignored. I check the homey app but cannot see anything wrong with that.

thanks Edwin

Good idea, I’m going to do that

1 Like

After a few days playing around and trying to find my “update flow” for the e-paper I’m running into some issues.

Somehow I cannot get the connection from Homeyduino e-paper to homey working.
Sometimes when not sending updates frequently enough, I get error message “Failed to connect with homey”. Also don’t get any triggers (for instance paperScreenOnline trigger when paper screen wakes up from deep sleep). This triggers only once, when I restart the homeyduino app (as suggested in the guide, so I know my network is ok).

And somehow I cannot disable deep sleep (sending value 0 doesn’t seem to work). Results in Error ESOCKETTIMEDOUT. The screen starts flashing, but after that the e-paper is still going into deep sleep.

Anyone any clues on how to debug and fix this?

which version did you use on the e-paper ( I used 1.2.3 but that 1 has issues) and you can try this as homey app GitHub - biemond/com.athom.homeyduinoSDK3: Homeyduino is an Homey app which allows you to easily connect your own Arduino projects to homey also had connection issues plus with homey app run you can see more.

Also I made 2 flows , 1 for static like label and icons (1 off). 1 for values
I use no batt, disable paperScreenOnline and do every minuted trigger with a flow with only values

Maybe push new version to e paper device and don’t do keep the settings.

Using version 1.2.3, so, back to 1.2.2 I suppose.

Good idea, will look into how to install this.

I wanted to use powerbank, but if it’s not working I’ll go this path also.

Yes, I was considering that also.

Thanks for these suggestions, will try them tomorrow. :grinning: