Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Some entities have been removed in Home Assistant 2021.11 #43

Open
jesserockz opened this issue Oct 29, 2021 · 18 comments
Open

Some entities have been removed in Home Assistant 2021.11 #43

jesserockz opened this issue Oct 29, 2021 · 18 comments

Comments

@jesserockz
Copy link

case ThreedyCondition.ETA:
return (
<TimeStat
timeEntity={ entity( mqtt ? '_print_time_left' : '_time_remaining' ) }
condition={condition}
config={config}
direction={0}
/>
)
case ThreedyCondition.Elapsed:
return (
<TimeStat
timeEntity={ entity( mqtt ? '_print_time' : '_time_elapsed' ) }
condition={condition}
config={config}
direction={1}
/>
)
case ThreedyCondition.Remaining:
return (
<TimeStat
timeEntity={ entity( mqtt ? '_print_time_left' : '_time_remaining' ) }
condition={condition}
config={config}
direction={-1}
/>
)

See breaking changes in the PR home-assistant/core#58040

@wokkeltje13
Copy link

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

  • ETA
  • Elapsed
  • Remaining

@SupremeSports
Copy link

SupremeSports commented Nov 6, 2021

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 :)

@0rax
Copy link

0rax commented Nov 7, 2021

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')"

@austwhite
Copy link

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

@SupremeSports
Copy link

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 👍

@thetic
Copy link

thetic commented Nov 10, 2021

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

@jezzaaa
Copy link

jezzaaa commented Nov 19, 2021

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
Copy link

jezzaaa commented Nov 19, 2021

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?

@genga91
Copy link

genga91 commented Nov 28, 2021

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

@austwhite
Copy link

austwhite commented Nov 29, 2021

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.

@SupremeSports
Copy link

Template code is given in previous comments... #43 (comment)

@genga91
Copy link

genga91 commented Nov 29, 2021

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
Copy link

genga91 commented Nov 30, 2021

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

@SupremeSports
Copy link

SupremeSports commented Dec 1, 2021

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

@Kilowatt-W
Copy link

Maybe somebody can fix this in the integration ?

:-)

@genga91
Copy link

genga91 commented Dec 16, 2021

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! :)

@MrHollowPS
Copy link

Thanks guys. This works just fine.

@e11en
Copy link

e11en commented Mar 14, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests