03-21-2017, 12:49 AM (This post was last modified: 04-12-2017, 09:30 PM by curlymo.)
Hello everybody.
I am a newbie, but I really want to dive into implementing new protocols for all of us. So please help me to start. Thank you so much.
To keep it short and simple, your time is precious...
Aim: to recognize my GRUNDIG QH-831A doorbell via pilight-receive and pilight_ctrl in FHEM
Done:
1. Read out RAW_LENGHT and PULSE_LENGHT(min/max/average) via pilght-debug
2. Copied existing protocol-files to /433.92/grundig.c and grundig.h
3. Adjusted PULSE_LENGHTHs and RAW_LENGHT in grundig.c (and replaced the protocol's name of course everywhere)
The rest I left "as it is"
4. Replaced the protocol's name in grunding.h
5. 433.92/protocol_header.h -> #include "grundig.h"
6. 433.92/protocol_init.h -> grundigInit();
7. service pilight -> stop -> start
Problem:
1. pilight-receive: no reaction
2. typing "pilight-send -p grundig" -> ERROR: this protocol is not supported or doesn't support sending
Question:
1. What do I have to do that the new protocol is recognized/implemented?
2. It would be sufficient to me to say:
if(RAW_LEN==36 AND 173<PULSE_LEN<176) --> send Message "Recieved"
What to do?
Dear communitiy, dear reader: thank you so much for any advice!
(03-21-2017, 12:49 AM)malte Wrote: 4. Replaced the protocol's name in grunding.h
5. 433.92/protocol_header.h -> #include "grundig.h"
6. 433.92/protocol_init.h -> grundigInit();
7. service pilight -> stop -> start
Problem:
1. pilight-receive: no reaction
2. typing "pilight-send -p grundig" -> ERROR: this protocol is not supported or doesn't support sending
Question:
1. What do I have to do that the new protocol is recognized/implemented?
Wait, did you recompile all of pilight and reinstall it? I'm just looking at this for the first time, but it looks like all the protocols are compiled in to the binary.
(03-21-2017, 10:18 AM)malte Wrote: TinkerBearNZ - thanks a lot. No, i did not. I'll have to find out how to "recompile all of pilight and reinstall it".
Yea, I would be more helpful... but I don't actually know how to do that myself.
I just gave it a quick try, and I clearly have not been using unix in a while.
You've got the source tree (since you've been editing it), so you've got that taken care of. "make install" isn't going to work, so I tried running "setup.sh" in the pilight source directory.
Ah, needs "cmake". "sudo apt-get install cmake". Now it needs "dialog" - it would have been nice if it said that earlier... "sudo apt-get install dialog"
Now if fails at "Looking for libpcap - not found". "sudo apt-get install libpcap" doesn't work, so something more subtle is needed... and I'm going to bed. I'll look at it tomorrow.
03-21-2017, 08:10 PM (This post was last modified: 03-21-2017, 10:04 PM by wo_rasp.)
The only other file you do need to edit is CMakeConfig.txt.
This file is the base for the user interface of Setup.sh to select a protocol or to disable it.
Most protocols are repeated several times, between the repetition is a gap of predetermined length, either caused by a header or a footer.
The first step is to determine the length of your protocol (e.q. the number of raw pulses including the footer pulses).
The second step is to determine the gap length between two footer value.
Once you have mastered this, the pilight-daemon will call the two callback functions validate and parsecode.
validate performs additional tests of the protocol, parsecode converts the raw pulses into binary and calls the function createMessage. createMessage saves the decoded data in JSON elements.
pilight-receive reports the JSON elements and its values to the user.
03-24-2017, 03:47 PM (This post was last modified: 03-24-2017, 03:48 PM by malte.)
Hello, yes, I made it: I compiled my new protocol named grundig!
But now I got REALLY lost again and do not know how to go on.
As I said, I only want this protocol to recognize that the doorbell-button has been pushed and then send a message, which is recieved by pilight-receive (and pilight_ctrl in FHEM).
(a) Message-sending
But I don't get it why no Message is sent. For testing purposes I also inserted a sendMessage(1,1,1) to the grundigInit(void). I thougt now I should recieve this testmessage in pilight-receive on initialisation of the grundig-protocol. But nothing happens.
Here is my current grundig.c (see attachment)
> Why is none of my messages sent? What to do to make it work?
> How can I see if and why not my conditions in "static int validate(void)" are fulfilled?
How can I output (see) the values of let's say
Or how can I see if validate() is even called?
> Where and how can I learn about the state and meaning of the variables and debugging my skript?
Possible to output f.e. grundig->raw[grundig->rawlen-1] or grundig->rawlen ?
(b) Analyzing the signal
Analyzing the signal of the doorbell I get confused about the different results between pilight-debug and pilight-raw.
pilight-raw shows that the doorbell sends 30 and more raw-signals per button-press, and they all seem to be a bit different.
pilight-debug only shows a few of these signals, and the shown raw-code seems to be modified (higher numbers).
But the pulse-length seems always to be between 174 and 175 (footer divided by 34)
I really do not understand how to read and to handle the correlation of the output of pilight-raw and pilight-debug and the footer and why you have to divide it by 34 to get the pulselenght and how to determine the gap length between two footer values (as wo_rasp says). And I do not know what to do with this gap-length.
It seems I don't know anything.
Is there any tutorial for really interested newbies?
The following is, what pilight-debug shows when I press the doorbell button:
Raw code: 1050 525 1050 525 1050 350 1050 525 1050 1225 350 525 1050 1225 350 1225 350 1225 175 1225 350 525 1050 525 1050 1225 350 525 1050 525 1050 525 1050 525 1050 5950
Sending this RAW-code makes the doorbell ring - sometimes. Why only sometimes? Sometimes it works a few times in a row, then sometimes i have to send the code 10 times before the bell rings. I do not understand the logic behind that behavior either.
Can anybody help me to get a bit further with all these questions, this lack of knowledge and curiosity?
Is there any documentation where I could learn more about the basics which I need for developing this recieve-one-button-protocol?
Thanks a BUNCH for every second you give reading my questions and answering!