alandtse / alexa_media_player

This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.
Apache License 2.0
1.44k stars 278 forks source link

last_called state attributes showing as null; api/activities returned 404:Not Found:text/html #2089

Closed oneseventhree closed 10 months ago

oneseventhree commented 10 months ago

IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.

Describe the bug

As the subject says:

image

To Reproduce

  1. Say "alexa"
  2. last_called used to change
  3. Now stays blank

Expected behavior

Screenshots Happens on all devices:

image

System details

Logs Please provide logs.

home-assistant_2023-10-25T09-39-31.640Z.log

Additional context

Morpheus2018 commented 10 months ago

IOBroker auf einem Py oder unter Proxmox installieren, danach Alexa2 und Mqtt Client installieren. Die letzte Alexa einfach per MQTT senden lassen und unter Homeassistant per Mqtt Sensor abfragen. Funktioniert fast in Echtzeit. Das Alexa2 Modul muss von Github installiert werde.

Hört sich machbar an, kannst du das trotzdem schritt für schritt die Installation, Umsetzung etc. erklären?

Daverover66 commented 10 months ago

IOBroker auf einem Py oder unter Proxmox installieren, danach Alexa2 und Mqtt Client installieren. Die letzte Alexa einfach per MQTT senden lassen und unter Homeassistant per Mqtt Sensor abfragen. Funktioniert fast in Echtzeit. Das Alexa2 Modul muss von Github installiert werde.

Hört sich machbar an, kannst du das trotzdem schritt für schritt die Installation, Umsetzung etc. erklären?

Exactly what I was thinking. I have an MQTT broker for zigbee2mqtt in Home Assistant and I'm running a Proxmox VE.

Daverover66 commented 10 months ago

My current solution, a bit complicated but works okay.

  • all routines start with volume 2.
  • or your desired volume, and also adjust it in the sensor.
  • All scripts must end with a time delay and volume 0.

sensor

    template:
      - sensor:
          - name: Last Alexa
            state: >
              {{ expand('group.all_alexa_echos') | selectattr('attributes.volume_level','eq', 0.2) | map(attribute='entity_id') | first }}
            availability: >
              {{ expand('group.all_alexa_echos') | selectattr('attributes.is_volume_muted','eq', True) | first is defined }}

script

alias: Test Last Alexa State
sequence:
  - service: notify.alexa_media
    data:
      data:
        method: all
      message: |
        *
      title: empty message to activate
      target: "{{states.sensor.last_alexa.state}}"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: notify.alexa_media
    data:
      data:
        method: all
      message: |
        The temperature is {{ states('sensor.terrassen_temperatur') }}°C
      title: your script
      target: "{{states.sensor.last_alexa.state}}"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - service: media_player.play_media
    data:
      media_content_id: volume 0
      media_content_type: custom
    target:
      entity_id:
        - media_player.alexa_echo_dot
        - media_player.home_fire_tab
    enabled: true
mode: single
icon: mdi:thermometer

Does setting the volume to 0 make the echo boop when the volume changes? I quite like this as a solution, but the constant boop of changing volumes bugs me so I have an automation that sets them all to 4 during the day and 2 in the evening and at night.

Daverover66 commented 10 months ago

for me, living at a big house with 5 alexa's, is a big problem indeed. Especially when I have built many automation based on sensor.last_alexa, such as "Is the water hot?"

When I saw that sensor.last_alexa is not been updated I thought I should try to update it manually. As soon as I replaced unknown with the name of a media player it worked! Then I thought why not use media_player.everywhere for a while until the problem is solved (hopefully).

I was n't lucky this time, When use media_player.everywhere my scripts are not working No error in logs this time, but not a reply from alexa either

From the AMP documentation, playing in groups needs a different method from playing on a single device.

master-kenobi commented 10 months ago

volume_level attribute doesn't work all the time. sometimes it updates immediately, sometimes it doesn't. when it doesn't work, I need to restart HA to make it work again. anyone faces the same issue?

Pirol62 commented 10 months ago

here as well. Setting the volume level has no immediate effect on the entity in HA

Update: I changed the volume level of one of my speakers 30 Minutes ago. Up to now no change in the attribute. I feel, that this information is not updated anymore as well as the last_called attribute. :-(

master-kenobi commented 10 months ago

here as well. Setting the volume level has no immediate effect on the entity in HA

Update: I changed the volume level of one of my speakers 30 Minutes ago. Up to now no change in the attribute. I feel, that this information is not updated anymore as well as the last_called attribute. :-(

Try restarting your HA. It works on mine after restart.

juan11perez commented 10 months ago

You just need to reload the alexa media player integration. You can create an automation with this action:


      - service: homeassistant.reload_config_entry # alexa integration reload
        target: {}
        data:
          entry_id: {{ config_entry_id('media_player.<some alexa device>') }}
sdholden28 commented 10 months ago

The volume tracking idea is a clever trick, and while it can work, it is far too unreliable to be used as the primary method going forward. Some devices report volume on every change, without intervention. Some don't report it at all, and someone only report it immediately following a reload of the alexa integration.

master-kenobi commented 10 months ago

You just need to reload the alexa media player integration. You can create an automation with this action:


      - service: homeassistant.reload_config_entry # alexa integration reload
        target: {}
        data:
          entry_id: {{ config_entry_id('media_player.<some alexa device>') }}

thanks. this is new to me. do I specify every media players by this integration or just any 1 media player will do?

Update: Just 1 media_player required to get the entry_id. However, I have tested it by executing this service when the volume_level has stopped updating. Unfortunately, it doesn't fix it. I still need to restart HA to fix it.

Fredo70 commented 10 months ago

Hi. I fix the issue in alexapy. But... It could not be perfect. Especially as far as the wake word is concerned. But basically it works. I have made a merge request: https://gitlab.com/keatontaylor/alexapy/-/merge_requests/361 Request to Contributors. Please check the changes and improve them if necessary. What is the next step? If it is ok, this version must be published on pypi. Who will do it? Then the new version must be referenced in alexa media player. Who does this? Please, I think I have done the roughest part. Can someone take care of the rest? Thank you

EDIT: I didn't fix clear_history.

AngelofromTurin commented 10 months ago

Hi.

I fix the issue in alexapy. But... It could not be perfect. Especially as far as the wake word is concerned.

But basically it works.

I have made a merge request: https://gitlab.com/keatontaylor/alexapy/-/merge_requests/361

Request to Contributors. Please check the changes and improve them if necessary.

What is the next step? If it is ok, this version must be published on pypi. Who will do it? Then the new version must be referenced in alexa media player. Who does this?

Please, I think I have done the roughest part. Can someone take care of the rest?

Thank you @Fredo70 Hi! Today i have time to try youre solution where I can look for youre file for change my configuration and try waiting the official solution ? Thank you !

Fredo70 commented 10 months ago

@AngelofromTurin Here is my fork: https://gitlab.com/Fredo70/alexapy But I can't really tell you how to test it. I have tested it in my dev environment for HA on another PC (not my productive system). I had to fight my way through the dev documentation. I have no idea how to do it. Note: the change is in the external pypi module "alexapy", not in the integration. And I just noticed that there is something wrong with the versioning. On pypi the current version is 1.27.6. And this is required by the integration. But in the repository, the latest version was 1.27.4, so I created a version 1.27.5. I would probably have to do 1.27.7. But why is 1.27.6 not in the repo? I don't understand that.

acid115 commented 10 months ago

It works like a charm! Big thanks!!! I have replaced the modified alexaapi.py within the container. It works. Thanks thanks thanks

douglasfranciscon commented 10 months ago

It works like a charm! Big thanks!!! I have replaced the modified alexaapi.py within the container. It works. Thanks thanks thanks

Can you explain how you did this? I'm an idiot and I don't know where to find alexaapi.py

ryangonzalez133 commented 10 months ago

Does anyone know where I can change alexaapi.py? in which container or how?

86lava commented 10 months ago

@Fredo70 - Thank you, thank you, thank you!

This modified alexaapi.py file is working for me, as well. It appears that the automations responding to Alexa requests must request to update last_called, Otherwise, it looks as the attribute updates somewhat arbitrarily.

action:
  - service: alexa_media.update_last_called
    data: {}
  - service: notify.alexa_media_last_called
    data_template:

The file is located in /usr/local/lib/python[your version here]/site-packages/alexapy/

I used the Advanced SSH & Web Terminal add-on (Use At Your Own Risk) to access the HA docker container.

formatBCE commented 10 months ago

@alandtse could you take a look into that PR?

I feel like everyone just has to stop trying to revive Alexa already, and ditch it for local voice control. It will be painful, but it's like bandaging rotten leg again and again instead of cutting it off...

douglasfranciscon commented 10 months ago

/usr/local/lib/python[your version here]/site-packages/alexapy/

I tried to locate this folder using terminal both on my host (I have Ha on a proxmox) and on the terminal that I installed and accessed through the HA menus. However, I can't find this file even using find in any of them. dummies lol

ahahamyan commented 10 months ago

I also have the same question. I could not find /usr/local/lib/python[your version here]/site-packages so I created a folder named alexapy in /root/config/custom_components and placed all the files there from Fredo70 repo and re-started HA, but it did not make a difference. Can someone explain how to update system with alexapy? I am running HA (Hass.io - in Virtualbox VM). Thanks much.

86lava commented 10 months ago

Using Advanced SSH & Web Terminal (with Protection mode turned off):

Run the command "docker exec -it homeassistant bash". This will give you access to /usr/local/lib/python[your version here]/site-packages/alexapy/

Linux commands to backup/rename the original file, and then copy the new file to the location of the original. I am by no means well-versed in the workings of docker and linux. I can't even name the particular type of HA install I am running (the recommended imager install on a RPi).

ahahamyan commented 10 months ago

Thanks. Will these changes get overriden when I update to newer version of HA? Each release is a new docker image, right?

ryangonzalez133 commented 10 months ago

For those who are having difficulty like I was, I will show how I performed the procedure on a Debian terminal.

To access the directory just run the command "docker exec -it homeassistant bash", then run "cd .." to return to the root directory. Then just explore the folders, with the command "cd /usr/local/lib/python[your python version]/site-packages/alexapy/"

To start, enter "docker exec -it homeassistant" in a terminal that is not running:

1-To make the change, upload the alexapy folder (https://gitlab.com/Fredo70/alexapy/-/tree/dev/alexapy?ref_type=heads) somewhere on your server. 2-For safety, make the backup with the command "docker cp homeassistant:/usr/local/lib/python[version]/site-packages/ /backup". 3-After that, remove the old alexapy folder by running the command "docker exec homeassistant rm -r /usr/local/lib/python[version]/site-packages/alexapy". 4-Move the new alexapy folder to docker with the command "docker cp /folder-on-host/alexapy homeassistant:/usr/local/lib/python3.11/site-packages". 5-Restart docker with "docker restart homeassistant"

Do it at your own risk. I performed the procedure and it resolved the problem.

thanks @Fredo70 !

86lava commented 10 months ago

Will these changes get overriden when I update to newer version of HA?

I would expect this to be included in an official update to the Alexa_Media_Player custom integration, as long as it pans out

86lava commented 10 months ago

4-Move the new alexapy folder to docker with the command "docker cp /folder-on-host/alexapy homeassistant:/usr/local/lib/python3.11/site-packages".

THIS must correspond to the version of python running on your installation.

danielbrunt57 commented 10 months ago

@alandtse could you take a look into that PR?

I feel like everyone just has to stop trying to revive Alexa already, and ditch it for local voice control. It will be painful, but it's like bandaging rotten leg again and again instead of cutting it off...

I sometimes use Alexa for more than just HA automation and I fail to see how HA Assist can answer a question like "Alexa, how long does it take a banana to ripen?" or "Alexa, what is the temperature in Puerto Rico?". I'm still interested in HA Assist though but wondering if anyone has figured out how to gut an Amazon Echo and replace with ESP32 and HA Assist??

On a related note, DFROBOT's Gravity: Offline Language Learning Voice Recognition Sensor for Arduino / Raspberry Pi / Python / ESP32 - I2C & UART is quite interesting...

Pirol62 commented 10 months ago

To whom it may help. Here my final solution:

I tried to be independent from "update_last_called" if it works or not. So I created a macro like this:

{% macro last_called_object(pobject, pmovement) %}
{% set last_called = states('sensor.last_called_alexa') %}
{% if last_called == 'media' %}
    {% set map = {
    "Wohnzimmer": "media_player.wohnzimmer",
    "Wohnzimmer 2": "media_player.wohnzimmer",
    "Wohnzimmer 3": "media_player.wohnzimmer",
    "Gästezimmer": "media_player.gastezimmer",
    "Gästezimmer 2": "media_player.gastezimmer",
    "Office": "media_player.office",
    "Office 2": "media_player.office",
    "Küche": "media_player.kuche",
    "Fitnessraum": "media_player.fitnessraum",
    "Fitnessraum 2": "media_player.fitnessraum",
    "Schlafzimmer": "media_player.schlafzimmer",
    "Schlafzimmer2": "media_player.schlafzimmer",
    "Treppe oben": "media_player.schlafzimmer"}
    %}
    {% set last_called = map[pmovement] if pmovement in map else 'media_player.wohnzimmer' %}
{% endif %}
{% if pobject == 1 %}
    {% set map = {
    "media_player.wohnzimmer": "light.wohnzimmer",
    "media_player.gastezimmer": "light.gastezimmer",
    "media_player.office": "light.office",
    "media_player.fitnessraum": "light.fitnessraum",
    "media_player.kuche": "light.kuche",
    "media_player.schlafzimmer": "light.schlafzimmer",
    "media_player.bad_yvonne": "light.schlafzimmer"}
    %}
    {{ map[last_called] }}
{% elif pobject == 2 %}
    {% set map = {
    "media_player.wohnzimmer": "switch.rituals_genie_wz",
    "media_player.gastezimmer": "switch.rituals_genie_dg",
    "media_player.office": "switch.rituals_genie_wz",
    "media_player.fitnessraum": "switch.rituals_genie_dg",
    "media_player.kuche": "switch.rituals_genie_wz",
    "media_player.schlafzimmer": "switch.rituals_genie_dg",
    "media_player.bad_yvonne": "switch.rituals_genie_dg"}
    %} 
    {{ map[last_called] }}
{% elif pobject == 3 %}
    {% set map = {
    "media_player.wohnzimmer": "input_boolean.light_livingroom_automation",
    "media_player.gastezimmer": "input_boolean.light_guestroom_automation",
    "media_player.office": "input_boolean.light_office_automation",
    "media_player.fitnessraum": "input_boolean.light_fitnessroom_automation",
    "media_player.schlafzimmer": "input_boolean.light_bedroom_automation",
    "media_player.bad_yvonne": "input_boolean.light_bedroom_automation"}
    %}
    {{ map[last_called] }}
{% elif pobject == 4 %}
    {% set map = {
    "media_player.wohnzimmer": "input_select.livingroom_scene",
    "media_player.gastezimmer": "input_select.guestroom_scene",
    "media_player.office": "input_select.office_scene",
    "media_player.kuche": "input_select.kitchen_scene",
    "media_player.fitnessraum": "input_select.fitnessroom_scene",
    "media_player.schlafzimmer": "input_select.bedroom_scene",
    "media_player.bad_yvonne": "input_select.bedroom_scene"}
    %}
    {{ map[last_called] }} 
{% elif pobject == 5 %}
    {% set map = {
    "media_player.wohnzimmer": "cover.rolladen_wohnzimmer",
    "media_player.gastezimmer": "cover.rollo_gastezimmer",
    "media_player.office": "cover.rollo_office",
    "media_player.kuche": "cover.rolladen_kuche",
    "media_player.fitnessraum": "cover.rollo_fitnessraum",
    "media_player.schlafzimmer": "cover.rollo_sz_fenster_gross"}
    %}
    {{ map[last_called] }} 
{% elif pobject == 6 %}
    {% set map = {
    "media_player.wohnzimmer": "script.command_sleepmode_livingroom_off",
    "media_player.kuche": "script.command_sleepmode_livingroom_off",
    "media_player.office": "script.command_sleepmode_livingroom_off",
    "media_player.fitnessraum": "script.command_sleepmode_guestroom_off",
    "media_player.gastezimmer": "script.command_sleepmode_guestroom_off"}
    %}
    {{ map[last_called] }} 
{% else %}
    {% set map = {
    "media_player.wohnzimmer": "im Wohnzimmer",
    "media_player.gastezimmer": "im Gästezimmer",
    "media_player.office": "im Office",
    "media_player.fitnessraum": "im Fitnessraum",
    "media_player.kuche": "in der Küche",
    "media_player.schlafzimmer": "im Schlafzimmer",
    "media_player.bad_yvonne": "im Schlafzimmer"} 
    %}
    {{ map[last_called] }}
{% endif %}
{% endmacro %}

In a script, it looks like this:

command_diffusor_on:
  variables:
     vtarget: "init"
     vmovement: "{{states('sensor.current_motion_location')}}"
  sequence:
    - service: alexa_media.update_last_called
    - delay: 00:00:01
    - variables:
        vtarget: >
          {% from 'global_functions.jinja' import last_movement_alexa_target %}
          {{ last_movement_alexa_target(vmovement) }}
    - service: logbook.log
      data:
        name: Diffusor on
        message: is being used from {{vtarget}}
    - service: switch.turn_on
      data:
        entity_id: >
          {% from 'global_functions.jinja' import last_called_object %}
          {{ last_called_object(2,vmovement) }}

The first step is to put the latest movement into a variable. Then call the alexa update. If it works, everythings fine, if not, the latest movement is the refrence. The last motion is captured like this:

- id: "20000"
  alias: Last motion
  trigger:
    - platform: state
      to: "on"
      entity_id:
        - binary_sensor.wohnzimmer
        - binary_sensor.wohnzimmer_2
        - binary_sensor.wohnzimmer3
        - binary_sensor.office
        - binary_sensor.office2
        - binary_sensor.fitnessroom
        - binary_sensor.fitnessroom2
        - binary_sensor.schlafzimmer
        - binary_sensor.schlafzimmer2
        - binary_sensor.treppe_unten
        - binary_sensor.treppe_oben
        - binary_sensor.guestroom
        - binary_sensor.guestroom2
  action:
    - service: variable.update_sensor
      data:
        value: "{{now().strftime('%H:%M:%S - %d-%m-%Y')}}"
        attributes:
          location: "{{trigger.to_state.attributes.friendly_name}}"
      target:
        entity_id: sensor.last_general_motion_detected
    - condition: template
      value_template: "{{ trigger.to_state.entity_id in('binary_sensor.wohnzimmer','binary_sensor.wohnzimmer_2','binary_sensor.wohnzimmer3') }}"
    - service: variable.update_sensor
      data:
        value: "{{now().strftime('%H:%M:%S - %d-%m-%Y')}}"
      target:
        entity_id: sensor.last_motion_detected_wz

The sensor current_motion_location simply exposes the attribute location.

It solves the issue for us here as we live with two person in the house and the last_motion is quite accurate. The object mapper saves tons of codelines and can be felxible enhenced.

ahahamyan commented 10 months ago

@alandtse could you take a look into that PR?

I feel like everyone just has to stop trying to revive Alexa already, and ditch it for local voice control. It will be painful, but it's like bandaging rotten leg again and again instead of cutting it off...

I have 9 echo devices in the house and I have them very well integrated with the HA ecosystem (90+ devices integrated, including Wifi, ZWave and Zigbee). Everything works perfectly. Besides HA integration, Alexa provides a lot of value for information access, etc.. which honestly, I would pay a nominal fee to Amazon even to keep it going, improving and opening access to it. So, use of Alexa is much broader than just HA integration. The update_last_called / notify last called is a great way to achieve pseudo request/response for those Alexa routines that call HA scripts (as scenes) that return information back - since there is no other way for a script to send back response to the device that was spoken to (I wish there was). The use of https://www.amazon.com/alexa-privacy/apd/rvh in the update to alexaapy by Fredo70 seems to be a good approach (I know it is webscraping and not a real API) that I would love to see the Alexa Media Player custom integration uptake as it gets proven out - because currently the scripts that return information back are all failing because of "Unable to find service notify.alexa_media_last_called" error.

dlgoodr commented 10 months ago

To install @Fredo70's branch while we wait for merges, launch your HA Terminal and...

wget https://gitlab.com/Fredo70/alexapy/-/archive/dev/alexapy-dev.zip
unzip alexapy-dev.zip
mv alexapy-dev/alexapy config/
rm -rf alexapy-dev*
ha core restart
sdholden28 commented 10 months ago

To install @Fredo70's branch while we wait for merges, launch your HA Terminal and...

wget https://gitlab.com/Fredo70/alexapy/-/archive/dev/alexapy-dev.zip
unzip alexapy-dev.zip
mv alexapy-dev/alexapy config/
rm -rf alexapy-dev*
ha core restart

Confirmed. Commands are accurate and procedure is valid. Results in a working "last alexa" sensor. Kudos to @dlgoodr

garysargentpersonal commented 10 months ago

Unfortunately this isn't working 100% of the time. Where another Alexa picks up the same command and they decide which one should handle the message, this sometimes throws things off (the wrong Alexa is set as last alexa).

Looks like we need to ignore items in the history with attribute: "utteranceType":"DEVICE_ARBITRATION"

Have added a comment on the pull request as such.

ahahamyan commented 10 months ago

To install @Fredo70's branch while we wait for merges, launch your HA Terminal and...

wget https://gitlab.com/Fredo70/alexapy/-/archive/dev/alexapy-dev.zip
unzip alexapy-dev.zip
mv alexapy-dev/alexapy config/
rm -rf alexapy-dev*
ha core restart

Confirmed. Commands are accurate and procedure is valid. Results in a working "last alexa" sensor. Kudos to @dlgoodr

Yes. Same scripts are working now untouched. Thanks much to all for this.

sdholden28 commented 10 months ago

Unfortunately this isn't working 100% of the time. Where another Alexa picks up the same command and they decide which one should handle the message, this sometimes throws things off (the wrong Alexa is set as last alexa).

Looks like we need to ignore items in the history with attribute: "utteranceType":"DEVICE_ARBITRATION"

Have added a comment on the pull request as such.

I've observed this behavior as well. This would be a good addition.

msolomos commented 10 months ago

To install @Fredo70's branch while we wait for merges, launch your HA Terminal and...

wget https://gitlab.com/Fredo70/alexapy/-/archive/dev/alexapy-dev.zip
unzip alexapy-dev.zip
mv alexapy-dev/alexapy config/
rm -rf alexapy-dev*
ha core restart

Confirmed. Commands are accurate and procedure is valid. Results in a working "last alexa" sensor. Kudos to @dlgoodr

Yes. Same scripts are working now untouched. Thanks much to all for this.

thank you so much! It works for me too!!!

mcmxb commented 10 months ago

Hey there, I tried the solution of @Fredo70 too. In my installation, it seems as if the last_called attribute only updates after a restart. I cant find out, why I always have to restart before the attribute updates.

Fredo70 commented 10 months ago

Hey there, I tried the solution of @Fredo70 too. In my installation, it seems as if the last_called attribute only updates after a restart. I cant find out, why I always have to restart before the attribute updates.

@mcmxb No change in this regard. You must call alexa_media.update_last_called service to refresh last_called.

ryangonzalez133 commented 10 months ago

I noticed that after the alexapy update, the automations had a longer delay before being activated, I don't know if there was some wrong configuration, but before it worked fine. Can you tell what it could be? @Fredo70

master-kenobi commented 10 months ago

Thanks @Fredo70. Everything works like it should now. The alexapy folder is now added to my config folder. I assume once it is merged into the official release, I can remove the folder?

Fredo70 commented 10 months ago

The last spoken text is also delivered (last_called_summary). In the old version there was something special because of Audible books, otherwise this text was empty. So the book title was set as summary. Since I don't have Audible, could someone test this? But it will certainly not set the book title as summary. Does anyone need this?

Fredo70 commented 10 months ago

I noticed that after the alexapy update, the automations had a longer delay before being activated, I don't know if there was some wrong configuration, but before it worked fine. Can you tell what it could be? @Fredo70

@ryangonzalez133 It may well be. But to be honest, I haven't noticed any perceptible difference.

garysargentpersonal commented 10 months ago

@Fredo70 has made changes to fix the issues with multiple Alexa's picking up the same text, and the wrong one being chosen as the last_alexa. Just download the zip as before. Working better for me. @sdholden28

douglasfranciscon commented 10 months ago

I noticed that after the alexapy update, the automations had a longer delay before being activated, I don't know if there was some wrong configuration, but before it worked fine. Can you tell what it could be? @Fredo70

How long is this delay? In my flows I always used a 2s delay to check which Alexa was called. In the tests I did, there really is a delay compared to using the "node-red-contrib-alexa-remote2-applestrudel" node " but with 2s of delay I had no problem with 5 Alexas in the house.

dlgoodr commented 10 months ago

@master-kenobi

Thanks @Fredo70. Everything works like it should now. The alexapy folder is now added to my config folder. I assume once it is merged into the official release, I can remove the folder?

you should absolutely remove the folder after it's in the official release. you won't get new updates if you don't.

garysargentpersonal commented 10 months ago

I just discovered an issue in the fix with some date logic. It means the fix will only work for 24 hours from last HA restart. Will be an easy fix, but until available you'll need to restart HA each 24 hours for the functionality to work.

Fredo70 commented 10 months ago

@garysargentpersonal Did you find anything in the code or were you able to observe this behaviour? I haven't had this problem so far. As I restarted this morning, I won't be able to see if it's really the case for me until tomorrow.

garysargentpersonal commented 10 months ago

@Fredo70 Put the HA integration in debug mode and observe the URL of the calls in logs after service call to refresh. The start and end times never change.

I put more details on the PR in gitlab.

Fredo70 commented 10 months ago

@garysargentpersonal Thank you very much. Fix is on its way.

lloydbayley commented 10 months ago

Nice find @garysargentpersonal ! Thanks to @Fredo70 for fixing! :)

msolomos commented 10 months ago

I just discovered an issue in the fix with some date logic. It means the fix will only work for 24 hours from last HA restart. Will be an easy fix, but until available you'll need to restart HA each 24 hours for the functionality to work.

What do you mean it doesn't work ??? For me it works smoothly with multiple alexa's. However after 24 hours the wrong alexa is chosen as the last_alexa. As soon as I restart HA it works again for 24 hours.

Is this what do you mean ??

garysargentpersonal commented 10 months ago

Yes