threedy icon indicating copy to clipboard operation
threedy copied to clipboard

Some entities have been removed in Home Assistant 2021.11

Open jesserockz opened this issue 4 years ago • 18 comments

https://github.com/dangreco/threedy/blob/de1be7a961ce47e161d9d0c7b79ea7d35716cfe2/src/Components/Stats/utils.tsx#L56-L84

See breaking changes in the PR https://github.com/home-assistant/core/pull/58040

jesserockz avatar Oct 29 '21 09:10 jesserockz

Had to remove the following monitors from my card to have it working again

  • ETA
  • Elapsed
  • Remaining

wokkeltje13 avatar Nov 04 '21 17:11 wokkeltje13

Hi, got the same issue, creating two template sensors temporarily patches the issue

    - name: OctoPrint Time Elapsed
      unit_of_measurement: 's'
      availability: >
        {{ not is_state('sensor.octoprint_start_time', 'unavailable') }}
      state: >
        {% set start = as_timestamp(states('sensor.octoprint_start_time')) %}
        {% if is_number(start) %}
          {{ (as_timestamp(now()) - start) | int }}
        {% else %}
          unknown
        {% endif %}
      attributes:
        start_time: "states('sensor.octoprint_start_time')"

    - name: OctoPrint Time Remaining
      unit_of_measurement: 's'
      availability: >
        {{ not is_state('sensor.octoprint_estimated_finish_time', 'unavailable') }}
      state: >
        {% set finish = as_timestamp(states('sensor.octoprint_estimated_finish_time')) %}
        {% if is_number(finish) %}
          {{ (finish - as_timestamp(now())) | int }}
        {% else %}
          unknown
        {% endif %}
      attributes:
        start_time: "states('sensor.octoprint_estimated_finish_time')"

For some reason I have an issue formatting this code in here :'(

EDIT: Thanks @0rax, with your example, I've been able to format mine correctly :)

SupremeSports avatar Nov 06 '21 02:11 SupremeSports

Thanks @SupremeSports, worked like a charm.

Here is a formatted version of the sensors:

template:
  - sensor:
    - name: "OctoPrint Time Elapsed"
      unit_of_measurement: 's'
      availability: >
        {{ not is_state('sensor.octoprint_start_time', 'unavailable') }}
      state: >
        {% set start = as_timestamp(states('sensor.octoprint_start_time')) %}
        {% if is_number(start) %}
          {{ (as_timestamp(now()) - start) | int }}
        {% else %}
          unknown
        {% endif %}
      attributes:
        start_time: "states('sensor.octoprint_start_time')"
    - name: "OctoPrint Time Remaining"
      unit_of_measurement: 's'
      availability: >
        {{ not is_state('sensor.octoprint_estimated_finish_time', 'unavailable') }}
      state: >
        {% set finish = as_timestamp(states('sensor.octoprint_estimated_finish_time')) %}
        {% if is_number(finish) %}
          {{ (finish - as_timestamp(now())) | int }}
        {% else %}
          unknown
        {% endif %}
      attributes:
        start_time: "states('sensor.octoprint_estimated_finish_time')"

0rax avatar Nov 07 '21 17:11 0rax

Similar issues. Although these entities are present in the Octoprint integration (via UI) they must be different to what this card looks for. If any of these are added it kills the whole lovelace page. ETA Elapsed Remaining

Can use a template like listed in other posts, but this is a bit of a messy work around

austwhite avatar Nov 10 '21 13:11 austwhite

Can use a template like listed in other posts, but this is a bit of a messy work around

I created this workaround as a, hopefully, temporary measure 👍

SupremeSports avatar Nov 10 '21 14:11 SupremeSports

Unfortunately, it appears that development on this project has stalled.

thetic avatar Nov 10 '21 18:11 thetic

Hi, got the same issue, creating two template sensors temporarily patches the issue

    - name: OctoPrint Time Remaining
      unit_of_measurement: 's'
      availability: >
        {{ not is_state('sensor.octoprint_estimated_finish_time', 'unavailable') }}
      state: >
        {% set finish = as_timestamp(states('sensor.octoprint_estimated_finish_time')) %}
        {% if is_number(finish) %}
          {{ (finish - as_timestamp(now())) | int }}
        {% else %}
          unknown
        {% endif %}
      attributes:
        start_time: "states('sensor.octoprint_estimated_finish_time')"

Shouldn't the second attribute (for "OctoPrint Time Remaining" be something like "estimated_finish_time" rather than "start_time"?

jezzaaa avatar Nov 19 '21 12:11 jezzaaa

Unfortunately for me, this solution doesn't work in my use case. What I want to do is send a notification on end-of-print, but with the condition that the elapsed time for the finished print was more than 15 minutes. Previously, elapsed time was available after the print had finished, but now it appears to be "unavailable". Is there a way I can access the elapsed time similarly to percentage complete and other values?

jezzaaa avatar Nov 19 '21 22:11 jezzaaa

Hi trying to make this workaround but I find some issues. I defined the sensor above like @0rax reported but don't understand how to recall it on the threedy card (if I have too?). If I tick one of the ETA Elapsed Remaining on the card, error appears. How did you do? thanks

genga91 avatar Nov 28 '21 23:11 genga91

I thought all the "sensors" were generated by Home Assistant and the integration. Threedy only displays the sensors that are available. A sensor that is unavailable would be an issue with the Octoprint Integration rather than with Threedy as far as I can tell.
The Integration within the UI Exposes 10 entities as far as I can see. Actual Bed Temp, Actual Tool Temp, Current State, Estimated Finish Time, Job Percentage, Printing, Printing Error, Start Time, Target Bed Temp, Target Tool Temp. Elapsed Time sensor is not generated any longer. You could use a template to work out elapsed time based on Start Time and current time and make that an Elapsed Time sensor. I am not good enough with templating in HA to give you the code though.

austwhite avatar Nov 29 '21 02:11 austwhite

Template code is given in previous comments... https://github.com/dangreco/threedy/issues/43#issuecomment-962372145

SupremeSports avatar Nov 29 '21 02:11 SupremeSports

Yes I copied the one formatted from @0rax but right now the threedy card with ETA, Elapsed and Remaining reports errors (these entities are not defined):

template:

  • sensor:
    • name: "OctoPrint Time Elapsed" unit_of_measurement: 's' availability: > {{ not is_state('sensor.octoprint_start_time', 'unavailable') }} state: > {% set start = as_timestamp(states('sensor.octoprint_start_time')) %} {% if is_number(start) %} {{ (as_timestamp(now()) - start) | int }} {% else %} unknown {% endif %} attributes: start_time: "states('sensor.octoprint_start_time')"
    • name: "OctoPrint Time Remaining" unit_of_measurement: 's' availability: > {{ not is_state('sensor.octoprint_estimated_finish_time', 'unavailable') }} state: > {% set finish = as_timestamp(states('sensor.octoprint_estimated_finish_time')) %} {% if is_number(finish) %} {{ (finish - as_timestamp(now())) | int }} {% else %} unknown {% endif %} attributes: start_time: "states('sensor.octoprint_estimated_finish_time')"

I defined them into sensor but how can I re-call it inside the threedy card?

genga91 avatar Nov 29 '21 07:11 genga91

Hey guys, could someone help me? I defined those sensors but I can't say them into my sensors and I didn't understand how to re-call them into the card definition. Could you explain me? thanks

genga91 avatar Nov 30 '21 22:11 genga91

Hey guys, could someone help me? I defined those sensors but I can't say them into my sensors and I didn't understand how to re-call them into the card definition. Could you explain me? thanks

When you create those sensors in template, they will be created as sensor.template_octoprint_time_elapsed and sensor.template_octoprint_time_remaining, you have to edit them and remove the template_ part from the entity_id.

Nothing else is needed as the card is looking for those 2 sensors with correct names

SupremeSports avatar Dec 01 '21 13:12 SupremeSports

Maybe somebody can fix this in the integration ?

:-)

Kilowatt-W avatar Dec 10 '21 16:12 Kilowatt-W

Hi... just wanna leave this update for everybody in case it will need. I finally got the sensors and everything is working well again. My problem is that I have multiple printers. Basically, the goal is to create two sensor like @SupremeSports made and @0rax formatted cause the threedy addon search and report those sensor in its section "time elapsed" and "time remaining". With just a printer is more simple and you should get it right from the box, but in case of multiple printers you need to pay attention of printer name. To get the name of the printer, add the threedy card on a dashboard and select the printer. Then check the yaml text, threedy report printer name, in my case octoprint 1. Well the sensor you have to create are:

template:

  • sensor:
    • name: "OctoPrint 1 Time Elapsed" unit_of_measurement: 's' availability: > {{ not is_state('sensor.octoprint_1_start_time', 'unavailable') }} state: > {% set start = as_timestamp(states('sensor.octoprint_1_start_time')) %} {% if is_number(start) %} {{ (as_timestamp(now()) - start) | int }} {% else %} unknown {% endif %} attributes: start_time: "states('sensor.octoprint_1_start_time')"
    • name: "OctoPrint 1 Time Remaining" unit_of_measurement: 's' availability: > {{ not is_state('sensor.octoprint_1_estimated_finish_time', 'unavailable') }} state: > {% set finish = as_timestamp(states('sensor.octoprint_1_estimated_finish_time')) %} {% if is_number(finish) %} {{ (finish - as_timestamp(now())) | int }} {% else %} unknown {% endif %} attributes: start_time: "states('sensor.octoprint_1_estimated_finish_time')"

Reboot Home assistant and you should find two sensors called: sensor.octoprint_1_time_elapsed and sensor.octoprint_1_time_remaining, which are exactly the sensors threedy addon need. Hope this will help someone! :)

genga91 avatar Dec 16 '21 01:12 genga91

Thanks guys. This works just fine.

MrHollowX avatar Dec 30 '21 10:12 MrHollowX

I've created a fork of this repo and fixed some issues like the state undefined stuff, check it out here: https://github.com/e11en/ha-threedy-card

e11en avatar Mar 14 '23 22:03 e11en