App to use Fenix watch as TV remote

Hello,

Anyone has made an app that controls the TV using SOAPACTION protocols and makeWebRequest calls?

I am trying to build an app for my watch (Fenix 8) that acts like a simple remote control for my Tv (Sony Bravia non android) with the 

:method => Communications.HTTP_REQUEST_METHOD_POST using the SOAPACTION protocols with the help of ai to code in monkeyC 

I have set up correctly the Tv settings, Ip, PSK... I have the correct ircc codes set-up.

1. i made a test file in python that works perfect with these settings and i can command the tv from the computer, all fine.

2. when I simulate the app in the connect IQ device simulator i always get the error code -200 (i couldn't get past this error no matter what settings i changed in the simulator).

3. when i sideload the prg to the watch i get different errors: -101 or -104 

4. i tried to "force" the watch to send directly to codes via wifi and not through the phone (turning off BT and wifi in phone) and got error code -200. 

Can I please get any suggestions? solutions? Thank you

  • 2. when I simulate the app in the connect IQ device simulator i always get the error code -200 (i couldn't get past this error no matter what settings i changed in the simulator).

    You can find the explanation of the error codes here:
    developer.garmin.com/.../Communications.html

    Error -200 corresponds to:
    INVALID_HTTP_HEADER_FIELDS_IN_REQUEST: The request contained invalid HTTP header fields.

    If you are using the SOAPAction header field, this suggests that either the header itself is not supported by Garmin, or that there is something in the header value that Garmin does not accept.

    3. when i sideload the prg to the watch i get different errors: -101 or -104 

    -101 stands for:
    BLE_QUEUE_FULL: Too many requests have been made.

    This error occurs when you send new requests before previous ones have completed. In a remote control scenario, where potentially every screen tap triggers a command, this can easily happen. To avoid this, you should either prevent the user from sending additional commands while a request is still pending, or actively cancel any outstanding requests before sending a new one. The best approach depends on your specific use case.

    -104 stands for:
    BLE_CONNECTION_UNAVAILABLE: No BLE connection is available.

    This simply means that no Bluetooth Low Energy connection is currently established. Possible reasons include: the phone is out of range, Bluetooth is disabled on the phone or the Garmin Connect app is not running or not functioning correctly.

    4. i tried to "force" the watch to send directly to codes via wifi and not through the phone (turning off BT and wifi in phone) and got error code -200. 

    Connect IQ apps only have permanent connectivity via BLE. While Wi-Fi may be available on the device, it is not maintained as a constant connection, to preserve battery life.

    If you want to use Wi-Fi, you must use a dedicated API that switches the app into what Garmin calls sync mode. In this mode, a built-in Garmin status screen is shown, the app can perform its tasks over Wi-Fi, and once finished, it returns to normal operation.

    Here is an overview of how that API works (scroll down to Wi-Fi):

    forums.garmin.com/.../connect-iq-3-1-connects-you-to-the-world

    As a final note, if you are looking for a ready-made solution, you might want to explore openHAB and check whether it provides a binding for your TV. There is, for example, a binding for IP-based Bravia TVs, although you would need to verify whether it supports the specific functionality you require.

    If it fits your use case, you could set up openHAB and then use my open-source Garmin app for openHAB:

    www.openhab.org/.../

    The app can also operate over Wi-Fi. This functionality is currently in beta and will be officially released soon.

  • Thank you for the response.

    I saw on openhab.org that 

    • Android: Only HTTPS with a valid certificate is supported due to Garmin SDK limitation

    in my scenario 3 

    when i sideload the prg to the watch i get different errors: -101 or -104 

    just before i get any errors i get "Req Failed" on the watch and after that the errors. i have an android phone with the Garmin app. 

    Is it this the reason i cannot get it to work? because i miss a  valid certificate and also my code uses http ? 

  • Yes, on Android you are unfortunately limited to HTTPS, and the connection requires a valid certificate to work. In that case, you would typically see a -1001 SECURE_CONNECTION_REQUIRED error. Are you sure the -101 you saw was not actually -1001?

    For the openHAB app, this can be resolved by connecting to the myopenhab.org cloud proxy, which provides a valid certificate, instead of connecting directly to your local instance.

  • Yes, the -101 error . and it is consistent with the error description BLE_QUEUE_FULL: Too many requests have been made. as I press the buttons rapidly on the watch 

    I will try the openHAB app thanks.

    this is my very first try to code anything and the only reason for it is because i am really lazy and didn't want to reach for the tv remote when i have the watch always on the wrist. but considering all the hurdles Id rather reach for the remote haha.

  • You can glue the TV remote to your hand. Believe me, it's much easier than learning Monkey C Rofl

  • First suggestion is to forget about using ai with monkeyc/ciq.  It's been known to give you complete nonsense,  Use the Garmin doc