Carrying on from part 1 we move on from codes converted from the old Pronto HEX format to learned codes
Initally these seem to have only a passing resemblence to the ECF codes converted from Pronto HEX. There are some bytes at the beginning that are the same but then after that not so much, and they are much, much longer
Here's a learned code for a Sony TV mute command, which is the same command that we had the Pronto HEX for
FFFF 2008 0100 0008 80AA 4004 3880 9E40 0440 809E 4004 4180 9C40 0444 809D 4004 4280 9C40 0445 809A
4004 4480 9740 0449 8099 4004 4780 9B40 0444 809A 4004 4580 9540 044B 8094 4004 4C80 9740 0447 809A
4004 4580 9840 0448 8098 4004 4880 9240 044D 8094 4004 4C80 9440 044A 8095 4004 4B80 9040 044F 8096
4004 4A80 9140 044E 8094 4004 4D80 8D40 0451 8092 4004 4D80 9240 044E 8090 4004 4F80 8F40 0451 8092
4004 4C80 9540 044A 8093 4004 4E80 9040 044F 808B 4004 5380 9240 044E 808F 4004 5180 8D40 0452 808E
4004 5280 8D40 0452 808E 4004 5180 8F40 0451 808F 4004 5180 8840 0455 808E 4004 5280 9040 0451 808A
4004 5480 8D40 0452 808E 4004 5280 8D40 0452 8091 4004 4F80 8F40 0451 808E 4004 5180 8940 0456 808A
4004 5680 8940 0456 8087 4004 5880 8840 0457 808C 4004 5580 8640 0459 808C 4004 5380 8B40 0454 808A
... and on and on for many, many lines
There is an apparent repetition of 4004 every 10 bytes, which differs from the 6 byte burst pairs seen previously. Other things we know are
- Philips like to pack numbers as small as possible
- We know the unit they use for measuring time, and it seems likely they would use it again
- The period, if it were to appear should be a number near 0x04da
- Sony codes use groups of 24 or 48 pairs, so we might see a pattern of these or numbers near 0x7470 or 0xe8e0 as before
- From the massive length of the learned code it seems likely it represents individual on/off timings rather than on/off of a carrier frequency
Reformatting gives
FFFF 2008 0100 0008 80AA
4004 3880 9E40 0440 809E
4004 4180 9C40 0444 809D
4004 4280 9C40 0445 809A
4004 4480 9740 0449 8099
4004 4780 9B40 0444 809A
4004 4580 9540 044B 8094
4004 4C80 9740 0447 809A
....
There are 2 instances of numbers near 0x04da in each line. Assuming these are stored in 2.5 bytes and re-formatting
FFFF 2008 0100 0008 80AA
4 00438 809E4 00440 809E
4 00441 809C4 00444 809D
4 00442 809C4 00445 809A
4 00444 80974 00449 8099
4 00447 809B4 00444 809A
4 00445 80954 0044B 8094
4 0044C 80974 00447 809A
....
There are columns that consistently contain 4 or 8, so
FFFF 2008 0100 0008 80AA
4 00438 8 09E 4 00440 8 09E
4 00441 8 09C 4 00444 8 09D
4 00442 8 09C 4 00445 8 09A
4 00444 8 097 4 00449 8 099
4 00447 8 09B 4 00444 8 09A
4 00445 8 095 4 0044B 8 094
4 0044C 8 097 4 00447 8 09A
....
Continuing in this style we find
4 0045D 8 086 4 07947 8 095
Where 0x07947 is approximately 25 times 0x04da. This is one more than the 24 we expected, however if we assume that this and other values preceeded with a control value of 4 are off times (which would be consistent with previous findings) then the value preceeded with control values of 8 must be the on times and those values are quite small. It seems then that the IR LED only lights up briefly during each period and spends most of the period in an off state. That would mean the final off state when the carrier is enabled would merge with the 24 units of off time equalling about 25. Also, it makes more sense that the first recorded action would be an on, not an off so the final word in the header is not actually part of the header. Correcting this and including more data
FFFF 2008 0100 0008
8 0AA 4 00438 8 09E 4 00440
8 09E 4 00441 8 09C 4 00444
8 09D 4 00442 8 09C 4 00445
8 09A 4 00444 8 097 4 00449
8 099 4 00447 8 09B 4 00444
8 09A 4 00445 8 095 4 0044B
8 094 4 0044C 8 097 4 00447
8 09A 4 00445 8 098 4 00448
8 098 4 00448 8 092 4 0044D
8 094 4 0044C 8 094 4 0044A
8 095 4 0044B 8 090 4 0044F
8 096 4 0044A 8 091 4 0044E
8 094 4 0044D 8 08D 4 00451
8 092 4 0044D 8 092 4 0044E
8 090 4 0044F 8 08F 4 00451
8 092 4 0044C 8 095 4 0044A
8 093 4 0044E 8 090 4 0044F
8 08B 4 00453 8 092 4 0044E
8 08F 4 00451 8 08D 4 00452
8 08E 4 00452 8 08D 4 00452
8 08E 4 00451 8 08F 4 00451
8 08F 4 00451 8 088 4 00455
8 08E 4 00452 8 090 4 00451
8 08A 4 00454 8 08D 4 00452
8 08E 4 00452 8 08D 4 00452
8 091 4 0044F 8 08F 4 00451
8 08E 4 00451 8 089 4 00456
8 08A 4 00456 8 089 4 00456
8 087 4 00458 8 088 4 00457
8 08C 4 00455 8 086 4 00459
8 08C 4 00453 8 08B 4 00454
8 08A 4 00455 8 08D 4 00453
8 08B 4 00454 8 08A 4 00456
8 089 4 00455 8 089 4 00457
8 08D 4 00453 8 08D 4 00451
8 085 4 0045A 8 08B 4 00455
8 08D 4 00452 8 08B 4 00455
8 08D 4 00453 8 08A 4 00456
8 084 4 0045A 8 086 4 0045A
8 08B 4 00455 8 086 4 00458
8 087 4 00458 8 08A 4 00456
8 083 4 0045D 8 087 4 00458
8 087 4 00458 8 086 4 0045A
8 087 4 00459 8 084 4 0045A
8 08A 4 00457 8 080 4 0045E
8 086 4 0045A 8 083 4 0045C
8 086 4 0045A 8 084 4 0045B
8 082 4 0045D 8 086 4 07947
So, here we have data representing 96 periods of oscillation followed by 24 periods of off, the expected lead in. Next is
8 095 4 0044C 8 088 4 00458
8 088 4 00457 8 089 4 00457
8 08F 4 00450 8 087 4 00459
8 085 4 00459 8 087 4 0045A
8 08A 4 00454 8 085 4 0045B
8 085 4 0045C 8 086 4 00458
8 086 4 00459 8 089 4 00457
8 082 4 0045D 8 085 4 0045C
8 081 4 0045D 8 087 4 00458
8 088 4 00458 8 082 4 0045E
8 07E 4 00462 8 082 4 0045D
8 07C 4 00463 8 083 4 0794A
24 oscillations and 24 periods of off, a value of zero
8 090 4 00452 8 084 4 0045B
8 086 4 00458 8 083 4 0045D
8 082 4 0045E 8 083 4 0045D
8 081 4 0045F 8 07E 4 00461
8 084 4 0045B 8 083 4 0045B
8 07F 4 00462 8 07B 4 00463
8 082 4 0045E 8 07D 4 00464
8 07D 4 00461 8 080 4 00460
8 07F 4 0045F 8 07A 4 00467
8 07D 4 00462 8 079 4 00467
8 07B 4 00464 8 07A 4 00464
8 081 4 0045F 8 07B 4 07954
Another zero
8 08A 4 00455 8 084 4 0045E
8 07A 4 00464 8 080 4 00460
8 082 4 0045D 8 078 4 00467
8 07B 4 00465 8 083 4 0045C
8 07C 4 00464 8 079 4 00467
8 079 4 00466 8 077 4 00468
8 07B 4 00464 8 07C 4 00464
8 075 4 00469 8 077 4 0046A
8 077 4 00468 8 07A 4 00465
8 075 4 0046B 8 074 4 0046E
8 075 4 00469 8 071 4 0046D
8 070 4 0046F 8 079 4 00467
8 077 4 00468 8 078 4 00468
8 070 4 00470 8 079 4 00466
8 078 4 00468 8 076 4 00468
8 077 4 00469 8 073 4 0046D
8 071 4 0046D 8 075 4 0046B
8 076 4 0046A 8 074 4 0046B
8 06E 4 00471 8 072 4 0046F
8 06C 4 00473 8 074 4 0046B
8 070 4 00470 8 06F 4 00471
8 070 4 0046F 8 072 4 0046C
8 075 4 0046B 8 071 4 0046E
8 06F 4 00471 8 074 4 07959
48 oscillations and 24 off, the first value of one. And the remainder
8 082 4 0045E 8 079 4 00467
8 078 4 00468 8 072 4 0046E
8 071 4 0046E 8 07A 4 00465
8 070 4 0046F 8 071 4 00470
8 071 4 0046D 8 072 4 0046E
8 06D 4 00473 8 06F 4 00471
8 06F 4 00471 8 06E 4 0046F
8 06D 4 00473 8 068 4 00478
8 068 4 00478 8 069 4 00476
8 06C 4 00473 8 06C 4 00473
8 06D 4 00474 8 065 4 0047A
8 06A 4 00476 8 06A 4 07963 (zero)
8 077 4 00469 8 06A 4 00476
8 070 4 0046F 8 06F 4 00471
8 06B 4 00475 8 06E 4 00471
8 06E 4 00470 8 06B 4 00476
8 069 4 00475 8 070 4 00470
8 06A 4 00477 8 068 4 00477
8 068 4 00477 8 06A 4 00476
8 069 4 00477 8 061 4 0047D
8 069 4 00476 8 068 4 00479
8 063 4 0047C 8 06A 4 00475
8 068 4 00478 8 064 4 0047A
8 069 4 00476 8 066 4 0047B
8 066 4 0047A 8 067 4 00477
8 066 4 00479 8 062 4 0047F
8 065 4 0047A 8 065 4 0047B
8 061 4 0047F 8 063 4 0047C
8 069 4 00476 8 063 4 0047B
8 065 4 0047D 8 064 4 0047A
8 066 4 00479 8 064 4 0047B
8 066 4 0047A 8 05F 4 00480
8 061 4 0047F 8 063 4 0047D
8 066 4 00478 8 067 4 0047A
8 062 4 0047C 8 064 4 0047C
8 065 4 0047A 8 061 4 0796D (one)
8 06E 4 00473 8 069 4 00477
8 065 4 0047B 8 06A 4 00475
8 05E 4 00481 8 063 4 0047D
8 063 4 0047C 8 064 4 0047B
8 061 4 00480 8 05E 4 00481
8 061 4 0047E 8 062 4 0047E
8 060 4 0047F 8 060 4 00480
8 060 4 0047E 8 061 4 0047E
8 05F 4 00481 8 05A 4 00486
8 05B 4 00485 8 05E 4 00480
8 065 4 0047A 8 05F 4 00483
8 059 4 00485 8 05C 4 07972 (zero)
8 06A 4 00478 8 05D 4 00482
8 05E 4 00481 8 058 4 00488
8 05B 4 00485 8 05F 4 0047F
8 057 4 00489 8 05E 4 00481
8 05A 4 00487 8 056 4 00487
8 05B 4 00488 8 05C 4 00481
8 058 4 00487 8 059 4 00488
8 055 4 0048B 8 051 4 0048E
8 05A 4 00483 8 05D 4 00484
8 056 4 0048A 8 053 4 0048C
8 058 4 0048A 8 055 4 00487
8 05E 4 00482 8 05B 4 07972 (zero)
8 05E 4 00482 8 059 4 00488
8 056 4 0048B 8 05B 4 00484
8 053 4 0048D 8 057 4 00487
8 057 4 00488 8 058 4 00489
8 052 4 0048E 8 058 4 00486
8 056 4 0048B 8 053 4 0048C
8 053 4 0048E 8 04B 4 00491
8 054 4 0048C 8 050 4 00490
8 053 4 0048D 8 04C 4 00493
8 051 4 0048D 8 052 4 0048F
8 04D 4 00492 8 051 4 00490
8 04D 4 00492 8 04A 4 00496
8 04D 4 00490 8 050 4 00493
8 048 4 00494 8 04C 4 00494
8 04E 4 00494 8 04A 4 00495
8 048 4 00499 8 048 4 00497
8 046 4 00496 8 053 4 0048D
8 04D 4 00494 8 048 4 00497
8 044 4 00499 8 048 4 00499
8 050 4 00490 8 048 4 00497
8 047 4 00499 8 04C 4 00492
8 04A 4 00497 8 04E 4 00491
8 047 4 0049A 8 044 4 0049B
8 042 4 0049B 8 045 4 07988 (one)
8 056 4 0048E 8 04A 4 00495
8 048 4 00496 8 04C 4 00496
8 046 4 00498 8 04A 4 00495
8 048 4 00498 8 047 4 00498
8 040 4 0049D 8 04B 4 00499
8 04C 4 00491 8 047 4 0049C
8 045 4 00499 8 048 4 00498
8 044 4 00499 8 04A 4 00495
8 04A 4 00498 8 03C 4 004A1
8 044 4 0049C 8 046 4 0049C
8 044 4 0049B 8 03F 4 0049E
8 043 4 0049D 8 043 4 07989 (zero)
8 050 4 00492 8 04A 4 00498
8 046 4 00499 8 03D 4 004A2
8 041 4 004A1 8 042 4 0049C
8 040 4 0049E 8 048 4 00498
8 03C 4 004A3 8 03F 4 0049F
8 048 4 00498 8 045 4 0049B
8 044 4 0049C 8 040 4 0049E
8 044 4 0049F 8 038 4 004A5
8 041 4 004A0 8 039 4 004A6
8 041 4 0049F 8 03D 4 004A3
8 03F 4 0049D 8 037 4 004AB
8 038 4 004A8 8 03E 4 0798F (zero)
8 050 4 0048F 8 03B 4 004A6
8 03D 4 004A2 8 041 4 0049E
8 036 4 004AD 8 03D 4 004A1
8 041 4 004A0 8 035 4 004A8
8 037 4 004A7 8 03C 4 004A5
8 035 4 004AC 8 036 4 004AA
8 03A 4 004A3 8 035 4 004AA
8 035 4 004AD 8 036 4 004A7
8 02B 4 004BA 8 032 4 004AA
8 030 4 004AF 8 02E 4 004B6
8 027 4 004B5 8 02C 4 004B3
8 036 4 004A9 8 030 4 0799C (zero)
8 044 4 0049D 8 03D 4 004A3
8 034 4 004AE 8 039 4 004A4
8 03D 4 004A4 8 02C 4 004B5
8 02F 4 004AB 8 03D 4 004A5
8 036 4 004AD 8 030 4 004AE
8 030 4 004B3 8 02D 4 004AE
8 02F 4 004B2 8 02E 4 004B0
8 030 4 004B1 8 025 4 004BA
8 022 4 004C3 8 02F 4 004AD
8 025 4 004BC 8 026 4 004B5
8 026 4 004BF 8 026 4 004B9
8 01E 4 004BE 8 02E 5 0D9D7 (final off is a little shorter, but that is normal for Sony. Another zero)
So the code is 0010100 10000. There is more data after this, but it's just a repeat of what we've seen. Sony codes don't have distinct initial and repeat bursts.
Taking the information gleaned from raw learn codes and assuming the format should be somewhat consistent we modify our previous attempt at a definition
- The header is only 3 words long
- Most everything after that is a command stream rather than purst pairs. Commands consist of a half byte control value followed by a variable length (but same for same control value) time period
- Finally there is an optional byte to define the repeat burst offset
Rearranging the data resulting from a Pronto HEX code to fit this gives
ffff 006c 0100 0008
0 a04da
6 07470 4 07460
6 07470 4 07460
6 1d1c0 4 0747a
6 07470 4 07460
6 07470 4 07460
6 0e8e0 4 0748a
6 07470 4 07460
6 0e8e0 4 0748a
6 07470 4 07460
6 07470 4 07460
6 0e8e0 4 0748a
6 07470 4 07460
6 07470 4 07460
6 07470 4 07460
6 07470 5 05000
4 00016 c 30000
0f
So the format spec now looks like
Field | Width | Example | Description |
---|---|---|---|
Type | Word | ffff | ffff = Learned code, eecf = Database code |
Length | Word | 006c | Count of bytes in ECF |
Unknown | 4 bytes | 0100 0008 | Presumably more than one field, but not known how many |
Command stream | Variable | See below | |
Repeat offset | Byte | 0f | Number of bytes from beginning of command stream at which the repeat burst starts |
Where the command stream consists of multiple commands defined as
Field | Width |
---|---|
Type | 4 bits |
Duration | 12 or 20 bits |
Where command types are
Command type | Meaning | Duration width | Example | Description |
---|---|---|---|---|
0 | Set carrier period | 2.5 bytes | 0 a04da | When carrier is on the period will be defined by the last 2 bytes of the duration. The purpose of the leading "a" in the duration is unknown, could the command type actually be 0a? |
4 | Off | 2.5 bytes | 4 07460 | Turn the IR LED off for the specified duration |
5 | End sequence | 2.5 bytes | 5 05000 | Ends a burst sequence and also turns off LED for duration |
6 | Carrier on | 2.5 bytes | 6 07470 | Enable modulation at the previously specified carrier frequency for the duration |
8 | On | 1.5 bytes | 8 03D | Turn the IR LED on for the specified duration |
c | Stop | 2.5 bytes | c 30000 | This is the final command in the stream. Purpose of duration not known. May not be present in learned codes |
- All times in units of 0.2 microseconds (1/50000000 s)
Hello! Did you tried to integrate RFX9600 into Home Assistant?