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

property size limited #478

Closed
Conspir3D opened this issue Jan 28, 2018 · 12 comments
Closed

property size limited #478

Conspir3D opened this issue Jan 28, 2018 · 12 comments

Comments

@Conspir3D
Copy link

Hi,
there seams to be a bug with the message size of a property.
When i do the following:

rgbNodeA.setProperty("config").send("{\"name\": \"" + name + "\",\
\"command_topic\": \"" + basetopic + deviceId + "/switch\",\
\"state_topic\": \"" + basetopic + deviceId + "/status1234567\",\
\"payload_available\": \"true\",\
\"payload_not_available\": \"false\",\
\"availability_topic\": \"" + basetopic + deviceId + "/$online\",\
\"qos\": \"0\",\
\"retain\": \"true\"}");
}

the payload of that topic is too huge and will not be send. But the json send here will be much bigger to implement all features.
If the payload is just one character less, it works.

@Conspir3D
Copy link
Author

This is what works:

{"name": "Test Device","command_topic": "homeassistant/light/test-id/switch","state_topic": "homeassistant/light/test-id/status123456","payload_available": "true","payload_not_available": "false","availability_topic": "homeassistant/light/test-id/$online","qos": "0","retain": "true"}

This not:
{"name": "Test Device","command_topic": "homeassistant/light/test-id/switch","state_topic": "homeassistant/light/test-id/status1234567","payload_available": "true","payload_not_available": "false","availability_topic": "homeassistant/light/test-id/$online","qos": "0","retain": "true"}

Note the '123456' concatnated at /status.

@timpur
Copy link
Contributor

timpur commented Jan 29, 2018

Firstly, very odd way of using homie (not how it's meant to be used)...... but moving past that there shouldn't be a limit on payload size ... and doesn't seem to be in homie code.

Maybe something to do with free heap, since String uses heap not stack.

@Conspir3D
Copy link
Author

I use it as it it meant, as an iot device framework ;)
What i try to do with this large payload is to do auto discovery of mqtt devices by home-assistant.io

Home assistant provide diffrent types of "sensors" each with a generic and individual config topic as JSON. This payload can become quite big as there are a lot of functional options.

I will investigate deeper into the issue, specially to find a way around that heap/stack issue of large payloads.

thankx a lot for this feedback which give me new ideas to work around this in case it'S not an homie issue.

@Conspir3D
Copy link
Author

When i publish this payload manually via cli, my mqtt broker (mosquitto) handles everything fine. I use gbNodeA.setProperty("config").send() only once at the setuphandler.

Then i tested to define the string as a c string like:

char configA[] = "{\"name\": \"Test Device\",\
\"command_topic\": \"homeassistant/light/test-id/switch\",\
\"state_topic\": \"homeassistant/light/test-id/status1234567\",\
\"payload_available\": \"true\",\
\"payload_not_available\": \"false\",\
\"availability_topic\": \"homeassistant/light/test-id/$online\",\
\"qos\": \"0\",\
\"retain\": \"true\"}"; 

rgbNodeA.setProperty("config").send(configA);

which doesn't make any difference.

As everything works as expected, the rgbNodeA.setProperty("config").send(configA); command breaks some where because of the largepayload but i have no idea, where and why. Are there any more debugging messages i may turn on?

Why did you mention that this is a very odd way of using homie ? Auto discovery is essential and sometimes needs a more complex (longer) payload than just a few characters. Mosquitto can handle payloads up to 260MB even if this is surly an overkill for MQTT!

@timpur
Copy link
Contributor

timpur commented Jan 30, 2018

I will look into this, there shouldn't be any limit to payload size. Will fix.

(been thinking about creating a homie addon for home assistant) (#306)

@timpur timpur self-assigned this Jan 30, 2018
@timpur timpur added the bug label Jan 30, 2018
@timpur timpur mentioned this issue Jan 30, 2018
17 tasks
@Conspir3D
Copy link
Author

I don't think that there is a need of any plugin, as this very nice framework have all needed features. From my point of view, there is only the configuration topic issue with the payload size which currently block this usage. Thanks a lot for feedback and this great framework.

@Conspir3D
Copy link
Author

Conspir3D commented Feb 2, 2018

Today i stumbled over another compile error at another project, but reminds me on this issue.

#error "MQTT_MAX_PACKET_SIZE is too small in libraries/PubSubClient/src/PubSubClient.h, increase it to at least 1000"

Maybe the Problem here is also related to any PACKET_SIZE setting at the PubSubClient library?
On the system i ran into that issue the MQTT_MAX_PACKET_SIZE is set to 128 ... quite low, but this is the default size at PubSubClient.

@timpur
Copy link
Contributor

timpur commented Feb 3, 2018

Tested, have no issue with message size. Can send and receive messages at lest 3x of the examples you gave me ....

Node_Message_Relay.advertise("msg").settable([](const HomieRange & range, const String & value) {
 Node_Message_Relay.setProperty("msg").send(value);
 return true;
});

Using home 2.0.0B3 Arduino ESP Core 2.4.0 QIO LwIP v2(536)
This is a bare bone sketch that i use for testing, so maybe use a basic homie sketch and see if your still having issues ?

@Conspir3D
Copy link
Author

Haven't time yet to retest, keep this issue alive e, will report if get back to that Project

@timpur
Copy link
Contributor

timpur commented May 20, 2018

@Conspir3D, no response, closing.

@timpur timpur closed this as completed May 20, 2018
@Conspir3D
Copy link
Author

Conspir3D commented May 20, 2018 via email

@timpur
Copy link
Contributor

timpur commented May 20, 2018

Sorry, google translation didn't really make sense...

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

No branches or pull requests

2 participants