Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Problem with switching on Yamaha radio via Lua script in Fibaro HC3 control panel


Question

Posted

 

I have a Yamaha radio from Musicast and sending from any web browser on the net to http://192. 168. 3. 15/YamahaExtendedControl/v1/main/setPower?power=on turns on the radio.
I wrote in LUA this code:

Code:

Lua

Please login or register to see this code.

Please login or register to see this code.

Please login or register to see this code.

Please login or register to see this code.

Please login or register to see this code.

Please login or register to see this code.

Please login or register to see this code.

Please login or register to see this code.

Please login or register to see this code.

content_copy

 

Problem:

Unfortunately it doesn't matter if anyone has any idea why?

2 answers to this question

Recommended Posts

  • 0
Posted

Please login or register to see this code.

is what I have

  • 0
  • Inquirer
  • Posted (edited)

    Hello,

    Sorry for the small amount of information in the first post.
    To see what's happening I changed the code to:

     

    local url = "http://192.168.1.76/YamahaExtendedControl/v1/main/setPower?power=on"
    local httpClient = net.HTTPClient({timeout = 10000})

    httpClient:request(url, {
        method = "GET",
        headers = {
            ["Accept"] = "*/*"
        },
        success = function(response)
            print("HTTP Request Success")
            if response.status == 200 then
                print("Response Code: " .. response.status)
                print("Response Data: " .. response.data)
            else
                print("Unexpected Response Code: " .. response.status)
                print("Response Data: " .. response.data)
            end
        end,
        error = function(err)
            print("HTTP Request Failed")
            print("Error Message: " .. err)
        end
    })


    And the answer is:

     

    09.05.2024] [17:38:08] [DEBUG] [SCENE38]: HTTP Request Success
    [09.05.2024] [17:38:08] [DEBUG] [SCENE38]: Response Code: 200
    [09.05.2024] [17:38:08] [DEBUG] [SCENE38]: Response Data: {"response_code":4}

     

    {"response_code":4} in Yamaha documentation means: Invalid request

     

    But if I change the query to the current device status:
    local url = http://192.168.1.76/YamahaExtendedControl/v1/main/getStatus

     

    I already receive:

    [09.05.2024] [17:43:07] [DEBUG] [SCENE38]: HTTP Request Success
    [09.05.2024] [17:43:07] [DEBUG] [SCENE38]: Response Code: 200
    [09.05.2024] [17:43:07] [DEBUG] [SCENE38]: Response Data: {"response_code":0,"power":"standby","sleep":0,"volume":60,"mute":false,"max_volume":161,"input":"net_radio","distribution_enable":true,"sound_program":"5ch_stereo","surr_decoder_type":"dolby_pl","direct":false,"enhancer":true,"tone_control":{"mode":"manual","bass":0,"treble":8},"dialogue_level":0,"link_control":"speed","link_audio_delay":"audio_sync","link_audio_quality":"uncompressed","disable_flags":0,"actual_volume":{"mode":"db","value":-50.5,"unit":"dB"},"contents_display":true}

     

    Which means correct communication.

    Edited by PawelK

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...