roberttidey / IRBlasterWeb

Infra Red Remote Blaster using esp8266 including bit bang libraries
9 stars 2 forks source link

IRBlasterWeb

Infra Red remote control blaster using esp8266

Changes 2019/01/15

temperature code excluded if not required

merged with iLumos repository

extra definition files added

Features

Commands are sent to ip/ir with arguments

parameter is normally the name of the button on the control and the code to use is found by looking up in the buttonnames list and then finding the code for this button in the device set up. If % is the first char of the parameter then the following code is used rather than by looking it up. Code definitions are normally just the hex bits to send. The definition may start with #bitcount# to override the default bit count for the device. This may be used in the device table or in supplied parameters. For example, %#20#12345 will send 20 bits from the hex string 12345.
If device is macro then parameter is the name of the file in SPIFFS containing the macro

JSON can be posted to /irjson and contains authorisation and an array of commands using the same arguments allowing a sequence to be used using the POST to irjson Example

{
    "auth":"1234",
    "commands": [
        {
            "device":"yamahaAV",
            "parameter":"hdmi4",
            "wait":"5000",
            "bits":"0",
            "repeat":"1"
        },
        {
            "device":"yamahaAV",
            "parameter":"hdmi1",
            "wait":"100",
            "bits":"0",
            "repeat":"1"
        }
    ]
}

Macros are held in SPIFFS files with a .txt extension (e.g macro startall is in file /startall.txt). They have exactly the same content as a JSON POST. They are executed by using the device name 'macro' and including the name of the macro file in the parameter field.

New macros can be generated by POSTING the macro content to /macro with the auth argument and an extra argument called macro containing name to be used. Example

{
    "auth":"1234",
    "macro":"test1",
    "commands": [
        {
            "device":"yamahaAV",
            "parameter":"hdmi4",
            "wait":"5000",
            "bits":"0",
            "repeat":"1"
        },
        {
            "device":"yamahaAV",
            "parameter":"hdmi1",
            "wait":"100",
            "bits":"0",
            "repeat":"1"
        }
    ]
}

Existing macros can be removed by using the same procedure but with no commands content.

Config

Remote controls definitions

Other web commands

Libraries

Temperature sensing

If TEMPERATURE is defined to be 1 at the top of the sketch then temperature sensing support is included. A config file espConfig is downloaded from a web host which contains some config data as described in the example file. The address of the EIOT server and its password need to be set up in the sketch.

Install procedure

Tool for gathering codes from a remote

This is a simple python program (rxir.py) expected to run on a Raspberry Pi and using a demodulated IR receiver connected to a GPIO.

Create a text file with a list of button names (broken into subsets for convenience). These files are named device-subset. When run it will prompt for device,subset,coding type (nec,rc5,rc6) and whether to check(y/n). The user is then asked to press the buttons.

The codes are then appended to a file called device.ircodes. If check is y then it will try to verify code looks sensible and will retry if required.

Note that the program assumes the GPIO is low when IR is off. I use a simple 1 transistor buffer between the sensor to convert to 3.3V which inverts the signal from the sensor (active low). If no inversion is used then modify the defintions at line 26-27

Triggering from Alexa

Alexa activate detector (Optional)