Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello there is no problem, rather a question. #5

Open
kotana opened this issue Jun 23, 2021 · 17 comments
Open

Hello there is no problem, rather a question. #5

kotana opened this issue Jun 23, 2021 · 17 comments

Comments

@kotana
Copy link

kotana commented Jun 23, 2021

How can I use this identity attribute?
Thanks in advance.
image

@rianadon
Copy link
Owner

It should work by providing only the duration:

type: custom:timer-bar-card
entities:
  - binary_sensor.irrigation_unlimited_c1_m
duration: { attribute: current_duration }

Let me know if this doesn't work / is inaccurate. The time_remaining in your screenshot looks of use, but I don't know how often it is updated.

@kotana
Copy link
Author

kotana commented Jun 24, 2021

Unfortunately it does not work.
It just shows me the current status. on or off.
image
image

@rianadon
Copy link
Owner

Double check you are on version 1.3! I've been adding the features to make this work very recently.

Otherwise, your configuration looks correct.

@kotana
Copy link
Author

kotana commented Jun 25, 2021

Hi,
I now have version V1.4
Unfortunately it does not work.
Only the status is displayed.

@rianadon
Copy link
Owner

I'm sorry I really have no idea why this is not working.

I've released another version that's added a debugging mode for showing what the card thinks the duration & time remaining are. It would be helpful if you could upgrade again, add debug: true to your configuration, and paste/screenshot the debugging information.

Not that I think it would make much difference to the problem at hand, but since your card has a current_start attribute, you could supply this config:

type: custom:timer-bar-card
entities:
  - binary_sensor.irrigation_unlimited_c1_m
duration: { attribute: current_duration }
start_time: { attribute: current_start }

Thanks for spending time on this!

@kotana
Copy link
Author

kotana commented Jun 25, 2021

Here is a screenshot of the debug
image

Oh by the way, dark theme does not work properly, the font cannot recognize mn in (debug mode)
image
image

@rianadon
Copy link
Owner

Aha! I see the problem! Looks like I have a bug duration didn't add correctly to compute the time remaining (-22.785 seconds + 0:01:00 duration, or 60 seconds = 37.215 seconds, not -22.7850:01:00.

I've fixed this problem in v1.6. Hopefully this one should solve the problem!

@kotana
Copy link
Author

kotana commented Jun 26, 2021

Hi,
so far everything works.
But there is still a problem with the filter or display.

filter is true ( everything is ok, i started nothing )
image

filter is true ( everything is ok, started the process )
image

filter is true ( everything is ok, process stopped, but the time continues. )
image
image

but when I press the F5 key everything is ok again.

If the filter is false this error does not happen.

Can I hide the icon and name?
If not, is that possible?

Oh yes, I have something else .. :)
Is that possible to implement?
image

@rianadon
Copy link
Owner

Yikes. I know what the problem is.

For weekdays, timers, and next_trigger, did you have in mind any designs of how these should be shown?

@kotana
Copy link
Author

kotana commented Jun 28, 2021

simple text is sufficient for weekdays.

Timers: think also as text

next_triger: as a bar

@rianadon
Copy link
Owner

rianadon commented Jun 28, 2021

Hmm I can't visualize how I could fit this all into one row, unless you'd like to draw me something.

For the text parts, A template sensor might fulfill your needs. Something like:

template:
  - sensor:
    - name: "Times"
      icon: mdi:clock
      state: >
        {% set weekdays = state_attr('switch.schedule_nachsaat_4x_taglich, 'weekdays') %}
        {% set times = state_attr('switch.schedule_nachsaat_4x_taglich, 'times') %}
         
        {{ weeekdays }} at {{ times }}

For next_trigger, from when would the bar start counting down? (that is, if next_trigger is the end time, what would be the start time?) You could set only end_time, which means the card would use the time last changed as the start time, but I don't know if that's what you want.

@luixal
Copy link

luixal commented Apr 23, 2023

Thanks for this issue, I'm using Irrigation Unlimited integration too and this worked like a charm. Maybe it would be a good idea to add it to the readme near the use with openSprinkler ;)

@rianadon
Copy link
Owner

Thanks for the suggestion! I added a link to the readme.

@luixal
Copy link

luixal commented Apr 24, 2023

I still have to polish some things on the irrigation unlimited side, such as how to get total irrigation remaining time (instead of per zone) so I can also show a timer-bar for the whole irrigation sequence.

If you like, I can make a PR with examples and how to set it up :)

Just let me know if you prefer me adding a section in the readme, or should I add a new md file and link it in the readme.

@luixal
Copy link

luixal commented Apr 24, 2023

The problem I'm facing is that the whole sequence duration is stored into an attribute in a yaml format, within an array. I can get the value using this template:

{{ state_attr('binary_sensor.irrigation_unlimited_c1_m', 'sequence_status')[1].duration }}

But I have no idea how to pass that duration to the timer-bar card, can you help @rianadon ?

Thanks!

PS: I wouldn't like to create a sensor/helper/entity for duplication this value, just get it from the attribute.

@rianadon
Copy link
Owner

rianadon commented Apr 24, 2023

Yes, please! A PR with your examples would be much appreciated. If it's short I'd prefer the readme, otherwise I'd prefer you make another issue with the integration doc label and link it to the readme. That way there's a spot for anyone who has questions to ask them.

Dealing with arrays is not something I expect to ever support in the card. If you'd like to avoid creating another sensor, maybe the config template card would help you pass in the value. I've never played with the card before, but it would be really awesome to see if it works.

This is a very rough example, but perhaps something along these lines:

type: 'custom:config-template-card'
variables:
  DURATION: states['binary_sensor.irrigation_unlimited_c1_m'].attributes.sequence_status[1].duration
entities:
  - binary_sensor.irrigation_unlimited_c1_m
card:
  type: custom:timer-bar-card
  entities:
    - binary_sensor.irrigation_unlimited_c1_m
  duration: { fixed: "${DURATION}" }
  start_time: { attribute: current_start }

@luixal
Copy link

luixal commented Apr 25, 2023

Hi,

Well, 2 stones, 1 bird, I had plans of playing around with config-template-card so... I can confirm timer-bar works without a problem. Here's my working example:

- type: custom:config-template-card
  variables:
  DURATION: >-
    states['binary_sensor.irrigation_unlimited_c1_m'].attributes.sequence_status[1].duration
  START_TIME: >-
    states['binary_sensor.irrigation_unlimited_c1_m'].attributes.sequence_status[1].start
  entities:
    - binary_sensor.irrigation_unlimited_c1_m
  card:
    type: custom:timer-bar-card
    entity: binary_sensor.irrigation_unlimited_c1_m
    icon: none
    active_icon: mdi:sprinkler-variant
    duration:
      fixed: ${DURATION}
      units: seconds
    start_time: ${START_TIME}

Anyhow, as irrigation goes on, time doesn't match accurately, but that's a problem on Irrigation Unlimited integration I think. Due to that , it has no sense to show the timer-bar and a percentage bar would be enough.

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

No branches or pull requests

3 participants