Amazon Echo Control - lastVoiceCommand not receiving updates

Hi there,

i´m currently having an issue with the Amazon Echo Control binding and the Channel of lastVoiceCommand.
The Channelt stopped working today and doesn´t receive any updates.
There´s also an error message in the log that suggests that Amazon has removed the lastSpokenText option.
2023-08-30 15:23:08.405 [WARN ] [core.thing.internal.ThingManagerImpl] - Failed to normalize configuration for thing 'amazonechocontrol:echo:home:arbeit': {thing/channel=Type description amazonechocontrol:lastSpokenText for amazonechocontrol:echo:home:arbeit:lastSpokenText not found, although we checked the presence before.}

Who´s currently working on the binding and can have a look at this?

kind regards
Michael


Edit: I`m using the following platform.

Raspbian GNU/Linux 11 (bullseye)
Linux 6.1.21-v8+
Raspberry Pi 4 Model B Rev 1.1
openHAB 4.0.1 - Release Build
4.0.1 org.openhab.binding.amazonechocontrol
1 Like

These messages have nothing to do with the removal of channels on Amazons side. The openHAB version of the binding never supported lastSpokenText, so the channel is probably there because you used a 3rd party version of the binding. Since the openHAB version has no knowledge of this channel, it can’t provide a proper channel definition.

It could be that i used a third party version of the binding in the past but i´m currently using the openHAB version.
I think it was a version from the community that had more features until they went into the regular binding.

So what could be the cause that i don´t get any updates on the lastVoiceCommand channels/items?
It worked fine until yesterday evening where i started the night time routine but stopped working in the morning when i wanted to use the morning routine.
I tried every Echo device i got and none of them updated the lastVoiceCommand.

lastSpokenText (from the messages above) is a different channel than lastVoiceCommand. lastVoiceCommand contains the last command received by Alexa, lastSpokenText contains the last text that was output by Alexa.

lastVoiceCommand indeed does no longer work because of a change of the behavior of Amazon’s servers (there is no notification about that any longer). Have look at the discussion here.

Interesting!
Strange that it was working until yesterday while others started having problems a month ago.

I believe it works until you re-connect/re-login or the connections is terminated by the server.

1 Like

mine stopped working now too. probably somewhere during this week.
maybe they shut down that function by region, germany here.

Same here. Since August 31st lastVoiceCommand hasn’t received any updates.

Yeah the workaround version worked for one day and then also stopped working.
I switched to an dummy item that is exposed to Amazon through myopenhab.
The only problem is, i can‘t identify which Echo was used to start the rule.

That‘s really a big bummer from Amazon.

Hey, since the other thread is closed - what is the right approach to get the latest version of the custom addon running on 4.2? After I upgraded from 4.1.0 to 4.2.1 the custom install I did last year was gone as it seems (auto removed?). So I installed the one from the marketplace page containing SmartHomeJ in its name having 4.2.0 as its version. RefreshActivity seems there. But lags are bigger than with the previous version. Is there a more recent (custom) version available that should be installed instead? As I can see only 4.1 release from the Github page.

in an other thread a user described how he uses network trace to identify the amazon devices that was used using a voice command.

I experienced lags too, but it had nothing to do with openhab: Amazon changed the servers so you have do disconnect and reconnect to get the new one (http://your_server:8080/amazonechocontrol/) . And a clear-cache is necessary too.

You don’t even need that. Just use a rule that triggers on a state change of the members of the group of lastCommand-items. In the rule context you have the triggering Item.

Does anyone know where i can find the latest bundle with the refreshActivity channel?
@J-N-K maybe :slight_smile:
oH 4.1.1

Nevermind! I had to reinstall the bundle and then do the logout/login again.

1 Like

under settings - json 3rd party add-ons - URLs add
https://download.smarthomej.org/addons-snapshot.json|https://download.smarthomej.org/addons.json
and then add the smarthomeJ-binding from the Add-On-Store.

1 Like

I´m still struggling to get the Alexa triggering item to work.
Currently it´s “stuck” ON when i´m using Alexa to turn it on.
The rule from @AlexMartin13 will be triggered with received command.
How do i get the state in Alexa back to OFF or something else, so i can trigger it again?

I could switch it ON and trigger the rule with ON instead of received command.
Then directly switch it OFF again.
Using UNDEF didn´t work because Alexa would show the switch as offline.

Is there anything i´m missing?

One of the two link

https://download.smarthomej.org/addons-snapshot.json

say permission denied…

Anyway the snapshot version seems to be inclued in the other link.
The problems is that also if updated version is still 4.3.0.2024010000

so i made this simple (simple because ChatGPT wrote for me)
that check the file version:

import requests
import zipfile
import time
from io import BytesIO

# Funzione per scaricare e leggere il contenuto di un file .kar senza estrarlo
def list_specific_file_from_kar(url, version_folder):
    # Scarica il file .kar
    response = requests.get(url)

    if response.status_code == 200:
        # Usa un buffer in memoria per il file zip
        kar_file = BytesIO(response.content)

        # Apri l'archivio come fosse un file zip
        with zipfile.ZipFile(kar_file, 'r') as zip_ref:
            # Cerca il file che inizia con org.smarthomej.binding.amazonechocontrol
            for info in zip_ref.infolist():
                if info.filename.startswith(f"repository/org/smarthomej/addons/bundles/org.smarthomej.binding.amazonechocontrol/{version_folder}/org.smarthomej.binding.amazonechocontrol"):
                    file_name = info.filename
                    file_date = time.mktime(info.date_time + (0, 0, -1))  # Converti la data in formato leggibile

                    print(f"File: {file_name}")
                    print(f"Data di modifica: {time.ctime(file_date)}")
                    print("-" * 40)
                    return
            print(f"Nessun file trovato che inizi con org.smarthomej.binding.amazonechocontrol nella versione {version_folder}.")
    else:
        print(f"Errore nel download del file: {response.status_code}")

# Funzione per trovare la cartella basata sul nome dell'URL
def get_folder_name_from_url(url):
    start = url.rfind("amazonechocontrol-") + len("amazonechocontrol-")
    end = url.rfind(".kar")
    return url[start:end]

# Funzione principale per gestire tutte le occorrenze di amazonechocontrol
def process_all_amazonechocontrol(data):
    for addon in data:
        if addon.get("id") == "amazonechocontrol":
            version = addon.get("version")
            version_url = addon.get("url")
            version_folder = get_folder_name_from_url(version_url)

            print(f"Versione: {version}")
            print(f"URL: {version_url}")

            # Scarica e mostra le date del file specifico dal .kar
            list_specific_file_from_kar(version_url, version_folder)

# URL del file JSON
url = "https://download.smarthomej.org/addons.json"
#url = "https://download.smarthomej.org/addons.snapshot.json"


# Scarica il contenuto JSON
response = requests.get(url)
data = response.json()

# Processa tutte le occorrenze dell'id "amazonechocontrol"
process_all_amazonechocontrol(data)


i hope that can help who want always the last version.

Racking my brains because I haven’t touched this code for a while, but I’m pretty sure the state of the refreshActivity item doesn’t matter. The rule should trigger when a command is received (even if the state doesn’t change):

Switch alexa_refresh "Alexa Refresh" {channel="amazonechocontrol:account:___:refreshActivity"}

I might be misreading it, and your issue is with the dummy items for lights, lamps etc. For those I use Expire to reset them to UNDEF and also the [itemStateRetrievable=false] tag to ensure Alexa doesn’t report them as offline:

Dimmer alexa_lights "Lights" (gDummies) {alexa="Light" [itemStateRetrievable=false], expire="6s, state=UNDEF" }
1 Like

That was the missing information i needed :slight_smile:
Using expire="6s, and itemStateRetrievable=false]
Thanks for the quick help.

fyi: Currently lastCommand is working without the need of being triggered by the refresh-channel. Let’s see how long this will last…
edit: It seems as it’s only working from time to time by itself