CUL not enough credit

Begonnen von kennybl, 10 April 2021, 16:27:16

Vorheriges Thema - Nächstes Thema

kennybl

Hello,

I am improving my app to control the MAX! heater thermostats and it sometimes works perfect.
The only problem is when i try to change the temperatures a few times after each other.

My log shows the not enough credit messages:

2021.04.10 11:21:09 2: cm, CUL not enough credit! credit10ms is 32, but we need 110. Waiting 78 seconds. Currently 1 messages are waiting to be sent
2021.04.10 11:22:30 2: cm, CUL not enough credit! credit10ms is 3, but we need 110. Waiting 107 seconds. Currently 1 messages are waiting to be sent
2021.04.10 11:24:20 2: cm, CUL not enough credit! credit10ms is 3, but we need 110. Waiting 107 seconds. Currently 3 messages are waiting to be sent
2021.04.10 11:26:09 2: cm, CUL not enough credit! credit10ms is 3, but we need 113. Waiting 110 seconds. Currently 4 messages are waiting to be sent
2021.04.10 11:28:02 2: cm, CUL not enough credit! credit10ms is 3, but we need 110. Waiting 107 seconds. Currently 4 messages are waiting to be sent
2021.04.10 11:29:51 2: cm, CUL not enough credit! credit10ms is 3, but we need 110. Waiting 107 seconds. Currently 5 messages are waiting to be sent
2021.04.10 11:31:41 2: cm, CUL not enough credit! credit10ms is 3, but we need 110. Waiting 107 seconds. Currently 6 messages are waiting to be sent
2021.04.10 11:33:30 2: cm, CUL not enough credit! credit10ms is 3, but we need 110. Waiting 107 seconds. Currently 7 messages are waiting to be sent
2021.04.10 11:35:20 2: cm, CUL not enough credit! credit10ms is 3, but we need 110. Waiting 107 seconds. Currently 8 messages are waiting to be sent
2021.04.10 11:37:09 2: cm, CUL not enough credit! credit10ms is 3, but we need 110. Waiting 107 seconds. Currently 9 messages are waiting to be sent
2021.04.10 11:38:59 2: cm, CUL not enough credit! credit10ms is 3, but we need 110. Waiting 107 seconds. Currently 9 messages are waiting to be sent
2021.04.10 11:40:48 2: cm, CUL not enough credit! credit10ms is 3, but we need 110. Waiting 107 seconds. Currently 10 messages are waiting to be sent


In my code i check the desired temperature from my database. If that is not the same as the MAX thermostat, i try to update it to the desired temperature.
The problem is when the 2 temperatures are not the same and the credits are empty, my program keeps trying to change the desired temperatures on the radiator thermostats so i keep getting more and more requests.

Is there a better way to improve this, i saw this (https://blog.mjwconsult.co.uk/modifying-cul-firmware-to-increase-send-limit-for-eq3-max-heating-thermostats/) but i am not sure if this will work on an arduino (Devices/CUL is changed, i use Devices/NanoCul), and also i don't know if this is "legal"?

Thanks for the help



Update:

Also, to just change 1 desired temperature, the cul uses 100 credits, is this normal? It seems a lot but maybe it is normal

KölnSolar

Zitatalso i don't know if this is "legal"?
That is the problem: it isn't. At least in Germany.  :'(
If you don't care about the legal requirements, it is just the small software issue.  ;)
RPi3/2 buster/stretch-SamsungAV_E/N-RFXTRX-IT-RSL-NC5462-Oregon-CUL433-GT-TMBBQ-01e-CUL868-FS20-EMGZ-1W(GPIO)-DS18B20-CO2-USBRS232-USBRS422-Betty_Boop-EchoDot-OBIS(Easymeter-Q3/EMH-KW8)-PCA301(S'duino)-Deebot(mqtt2)-zigbee2mqtt

kennybl

I am not sure how "bad" it would be, normally the temperatures are changed a few times a day but the problem is that when i change the temperatures a few times after each other (or different rooms at the same time) i get these problems.

Is it normal that changing 1 temperature costs 100 credits? I think the cul has 900 per minute? I don't fully understand the credits.
How can i change the code to accept more on the nanoCUL?

rudolfkoenig

ZitatI think the cul has 900 per minute?
Nope, it is 900 per 15 Minutes (aka 900 Seconds), and it is decreased by one for each 10ms of transmission.

It is the 1% rule: a sender on this frequency range ist not allowed to transmit for more than 1% of the time, if it is not doing LBT (Listen before Talk). AFAIK the interval it is not specified, so it is not clear if the 1% is meant for one minute, hour, or day. I choose 900, as "shouting" for 9 seconds without a break seemed more than enough for me. Changing this number to a larger value is probably still legal, but it is more likely to cause problems if you are not "alone".

kennybl

Okay, thank you for explaining. Is there a way to figure out how many credits are used for what process?
I can get the amount of remaining credits and i can check if the value is more than for example 100, i can request an update, otherwise wait. But i have no idea how i can check how many credits are needed for what change

rudolfkoenig

On "attr device verbose 5" you get the necessaryCredit for each command you issue.

Looking at 14_CUL_MAX.pm the issue seems to be, that in order to wake up the device, you have to send a preamble for one second (100 credits), the rest is more or less neglectable. That means a command every 100+ seconds, roughly 2 minutes.
Since the preamble probably wakes all devices, it should be possible to send the data in a more credit (and device battery) efficient way, if you have more than one device. There was an entry in this forum some days ago regarding this (https://forum.fhem.de/index.php/topic,119766.0.html), but I dont know the state of the implementation.

kennybl

Thank you for the link but it is a bit difficult for me to understand.

I have about 15 devices so saving credits would be more than welcome. I still don't understand how i can make this more efficient. My german is not that good as well.

Now i check before an update if i have more than 120 credits available, i think this will work a bit better but not perfect

Wzut

a. if 900 credits are not enough: use a-culfw then you have 3600

b. I don't understand why you have to manually adjust the desired temperature so often in the first place.
If you have many desired temperature switchings in one day, why you don't use the weekly profiles ?
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

kennybl

I don't want to change the temperatures that often, i have mutliple rooms with multiple programs, now i think about it, maybe i can send my custom program to the thermostats instead of sending the desired temperature as my program changes.

Now i manually set the temperatures from the thermostats when my program changes, probably this can be done more efficient