RFH: Switch between I2S line-in and I2S microphone

Home Assistant FTW!

image

The bottom three buttons do all the work - the right button is ‘Restart’ (a standard part of the HA WLED integration) - this has to be pressed after toggling between line-in and mic.

The left (line-in) and centre (microphone) buttons make calls to rest commands in configuration.yaml:

rest_command: 
  wled_line_in:
    url: "http://{{url}}/json/cfg"
    method: post
    content_type:  'application/json; charset=utf-8'
    payload: '{
                "um": {
                  "AudioReactive": {
                    "digitalmic": {
                    "type": 4,
                    "pin": [
                        35,
                        25,
                        27,
                        0,
                        -1,
                        -1
                        ]
                        }
                    }
                }
            }'
  wled_microphone:
    url: "http://{{url}}/json/cfg"
    method: post
    content_type:  'application/json; charset=utf-8'
    payload: '{
                "um": {
                  "AudioReactive": {
                    "digitalmic": {
                    "type": 1,
                    "pin": [
                        26,
                        5,
                        21,
                        0,
                        -1,
                        -1
                        ]
                        }
                    }
                }
            }'

Just add your WLED url as service data

      service_data:
        url: 192.x.x.x

under the ‘service:’ line in the UI Button card.

This now does what I need it to do so won’t be pursuing the physical button route.

Thank you for your help & guidance.

P.S. It says ‘SoundReactive’ on the buttons but I’m running MM v0.14.1-beta.30 as above.