Jump to content
Flirc Forums

MikeP

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by MikeP

  1. A forum member asked how I converted a CSV file I had created originally into a JSON file and I figured I would share with everyone.

    I pulled my codes from here https://www.remotecentral.com/cgi-bin/codes/yamaha/rx-v1000/

    Here is how I got my json file.  I am familiar with the Linux command line so I performed the following steps.

    Before I show these let me say that an easier way could be to open a spreadsheet program and copy the button name into one column and the code for the button into another column. The second column needs to have the spaces between the numeric codes replaced with commas. You should then be able to save to the CSV file. It is possible you spreadsheet program may be able to save the file to JSON. If not, you may be able to use an online tool to do that basic work.

    I followed the following steps to dump the html page into a bit more of a manageable file. The steps below have been modified from the blog post.


    lynx -dump 'https://www.remotecentral.com/cgi-bin/codes/yamaha/rx-v1000/' | sed -e 's/^ *//' | tr -s ' ' ',' | sed 's/$/,/' > dumped_page.txt

    I then ran the following commands to strip out more of what I did not need.

    sed -i '/\[filler\.gif\]/d' dumped_page.txt
    sed -i '/\(Copy,to,Clipboard\)/d' dumped_page.txt
    sed -i '/\[filler\.gif\]/d' dumped_page.txt

     

    I then opened the dumped_page.txt file into a text editor and removed all the text I did not need. How I found that was by looking for these couple of lines of text

      Remote Model: RAV222
      [filler.gif]
      Power
      ([23]Copy to Clipboard)


    Power is where my first button started so I removed every line above Power in the file.

    I then looked for the equivalent of the bottom the button codes.

     [filler.gif]
      [ < Back | Page: 1 [43]2 | [44]Next > ]
      [filler.gif]


    I removed everything starting from the first filler.gif line to the bottom of the file.

    I then combined all the codes for each button onto one line.

    BEFORE

    Stadium,
    0000,006b,0022,0002,0156,00ad,0015,0015,0015,0041,0015,0015,0015,0041,
    0015,0041,0015,0041,0015,0041,0015,0015,0015,0041,0015,0015,0015,0041,
    0015,0015,0015,0015,0015,0015,0015,0015,0015,0041,0015,0041,0015,0015,
    0015,0041,0015,0041,0015,0015,0015,0015,0015,0015,0015,0041,0015,0015,
    0015,0041,0015,0015,0015,0015,0015,0041,0015,0041,0015,0041,0015,0015,
    0015,05f8,0156,0057,0015,0e57,

    AFTER

    Stadium,0000,006b,0022,0002,0156,00ad,0015,0015,0015,0041,0015,0015,0015,0041,0015,0041,0015,0041,0015,0041,0015,0015,0015,0041,0015,0015,0015,0041,0015,0015,0015,0015,0015,0015,0015,0015,0015,0041,0015,0041,0015,0015,0015,0041,0015,0041,0015,0015,0015,0015,0015,0015,0015,0041,0015,0015,0015,0041,0015,0015,0015,0015,0015,0041,0015,0041,0015,0041,0015,0015,0015,05f8,0156,0057,0015,0e57

    Since I know I am working with a CSV file I removed the last comma from each line since I do not need it and it could cause problems when creating the JSON file

    I saved that file which now gives me 20 lines for my remote and then i ran another script to convert the CSV into a JSON file. Notice that I filled in the "types", "brand", and "model" with what was relevant to me. I redirected the output of the script to a file.

    #!/usr/bin/env bash

    cat << EOF
    {
      "header": {
        "version": "2.0"
      },
      "types": [
        "devices.audio"
      ],
      "brand": "Yamaha",
      "model": "RX V-1000",
      "signals": [
    EOF

    while read -r line; do
        _label=$(echo "${line}" | cut -d ',' -f 1)
        _code=$(echo "${line}" | cut -d ',' -f 2- | tr '[:lower:]' '[:upper:]')
        cat << EOF
        {
            "label": "${_label}",
            "code": "${_code}",
            "protocol": "PRONTO"
        },
    EOF

    done < dumped_page.txt

    cat << EOF
      ]
    }
    EOF

     

    One thing to keep on mind is that JSON is picky about commas and where then end up and the end of blocks. I will show what I mean with the last two entries of my JSON file.

       {
           "label": "RO Concert",
           "code": "0000,006B,0022,0002,0156,00AD,0015,0015,0015,0041,0015,0015,0015,0041,0015,0041,0015,0041,0015,0041,0015,0015,0015,0041,0015,0015,0015,0041,0015,0015,0015,0015,0015,0015,0015,0015,001
    5,0041,0015,0015,0015,0015,0015,0041,0015,0041,0015,0015,0015,0015,0015,0015,0015,0041,0015,0041,0015,0041,0015,0015,0015,0015,0015,0041,0015,0041,0015,0041,0015,0015,0015,05F8,0156,0057,0015,0E57",
           "protocol": "PRONTO"
       },   <----- NOTICE THIS COMMA
       {
           "label": "Stadium",
           "code": "0000,006B,0022,0002,0156,00AD,0015,0015,0015,0041,0015,0015,0015,0041,0015,0041,0015,0041,0015,0041,0015,0015,0015,0041,0015,0015,0015,0041,0015,0015,0015,0015,0015,0015,0015,0015,001
    5,0041,0015,0041,0015,0015,0015,0041,0015,0041,0015,0015,0015,0015,0015,0015,0015,0041,0015,0015,0015,0041,0015,0015,0015,0015,0015,0041,0015,0041,0015,0041,0015,0015,0015,05F8,0156,0057,0015,0E57",
           "protocol": "PRONTO"
       }   <----- IT CANNOT EXIST AT THE END
     ]
    }

     

    • Like 1
  2. 1 minute ago, jason said:

    Thank you so much and I’m sorry this is still ongoing.  I thought I fixed it as no one has provided a log and I have not been able to reproduce it myself anymore. 
     

    Unfortunately, pulling the batteries out clears the logs. When this happens. The remote will take about 8 seconds and restart. Once it does. It should work in the computer and we can grab the logs. 

    I want to make sure I understand so I can capture the logs properly if it happens again. Do you mean that if the buttons are not working, I have to wait for 8 seconds after a button press and then pull the logs?

  3. I am running 4.12.12-0-g5306d89 firmware and I have run into a periodic problem where the remote stops responding to all button presses and the only solution is to pull the batteries and put them back in. I have two log files and I hope they are helpful but not having timestamps in the log file makes it difficult to know when the log entries were created.

    I think this is the relevant log file name flirc-remote-control20230331.log

    Thank you and the team for all the hard work.

    flirc-remote-control20230409.log flirc-remote-control20230331.log

  4. Is it possible to provide an option to change the font color to black rather than gray. Looking in the screenshot the text is hard to read. The font color is a bit better in the second screenshot but, for me, a darker font color would make the UI easier to read.

    Thanks for all the work you are doing on the app.

     

     

    Screenshot_20230322_190915.png

    Screenshot_20230322_191221.png

  5. 7 hours ago, Nathan said:

    Delay is after the action occurs. So Action 1, delay, Action 2, delay, Action 3. After the final action, there should be no need for a delay, because there's nothing else the remote is sending on that button. 

    Thanks for the update.

  6. I have a Yamaha RX V-1000 AV receiver, which is not in the database, and I followed the directions above but when I went to import, I get an error saying the format is invalid.  I noticed in the Admin panel that the expected format is a json file. I believe I have a properly formatted file and when I found a relevant forum post I believe my format is correct.

    What am I missing with my file? I have attached what I found and here is where I got the codes.

    https://www.remotecentral.com/cgi-bin/codes/yamaha/rx-v1000/

     

     

    This is a fantastic product and I cannot wait to start using it with my devices. Thank you and the team for all the hard work.

     

    Yamaha-RXV1000-AV.json

×
×
  • Create New...