Skip to content

Few changes to better interact with UI #14

Open
ciechompl wants to merge 1 commit into
hhaim:masterfrom
ciechompl:master
Open

Few changes to better interact with UI #14
ciechompl wants to merge 1 commit into
hhaim:masterfrom
ciechompl:master

Conversation

@ciechompl

Copy link
Copy Markdown

Few features to show interesting thing in the UI:

  • show schedule in variable.wbi_schedule_pX
  • calculate next planned irrigation duration every hour and pass it to input_number.wbi_pX_duration
  • alternative for accumulator in order to show some statistics of total irrigation time (today, yesterday, current week, month, year)

Changes to be committed:
modified: apps/apps.yaml
modified: apps/heat_app.py
modified: pkgs/irrigation.yaml

Few features to show interesting thing in the UI

Changes to be committed:
	modified:   apps/apps.yaml
	modified:   apps/heat_app.py
	modified:   pkgs/irrigation.yaml
@hhaim

hhaim commented Apr 23, 2020

Copy link
Copy Markdown
Owner

@ciechompl the code in AppDeamon is not needed you can do it in the UI
It is just queue_size * week duration. There is no need to run this math every hour!
The queue size is the important factor and it is exposed as a variable to Grafana

In short I suggest to remove the AppDaemon part

@ciechompl

ciechompl commented Apr 23, 2020

Copy link
Copy Markdown
Author

WBI calculate irrigation time as the following: irrigation_time_min = int((-queue) * duration_min / self.max_ev_week)
queue comes from sensor sensor.wb_irrigation_pX (available in UI)
duration_min comes from input_number.wbi_week_pX_duration (available in UI)

max_ev_week is a calculated as the following: max_ev_week = 7.0 * hours * (0.46 * tmean + 8.13)
hours comes from m_temp_hours defined only in apps.yaml
tmean comes from m_temp_celsius defined only in apps.yaml
so both are not available in UI.

Of course we can assume that we could set another variable (or whatsoever) to hard-define max_ev_week or alternatively move m_temp_hours & m_temp_celsius to some input_numbers from UI but i think we always should take up to date data :)

Please suggest which is your preferred way to modify ?
a) AppDeamon part as i proposed so far (benefit is that we use exactly the same line of code as will be used during irrigation)
b) define m_temp_hours & m_temp_celsius in the UI as input_numbers (still small AddDeamon part needs to be updated)
c) add new variable to pass max_ev_week to UI and do everything else in UI (still small AddDeamon part needs to be updated)
d) skip every change and hardcode max_ev_week and do math , all in UI only
e) any other idea ? :)

@hhaim

hhaim commented Apr 23, 2020

Copy link
Copy Markdown
Owner

@ciechompl

  1. show schedule in variable.wbi_schedule_pX

[hh] good idea

  1. calculate next planned irrigation duration every hour and pass it to input_number.wbi_pX_duration

[hh] I don't see a need to calculate it every hour. You can extract this info from the variable wpi_px_hours

  1. Alternative for an accumulator ..

[hh] use 2 variable for that

@ciechompl

ciechompl commented Apr 23, 2020

Copy link
Copy Markdown
Author

wpi_px_hours

typo or I missed something :) ?

@hhaim

hhaim commented Apr 23, 2020

Copy link
Copy Markdown
Owner

It is not a typo:

sensor:

  - platform: accumulator
    name: wbi_p1_hours
    entity_id: switch.wbi_p1
    state_on: 'on'
    state_off: 'off'

  - platform: accumulator
    name: wbi_p2_hours
    entity_id: switch.wbi_p2
    state_on: 'on'
    state_off: 'off'

@ciechompl

Copy link
Copy Markdown
Author

ok so I think i explained wrongly what I want to achieve :)

My main goal is to see how the elapsed time and weather conditions affecting the calculated time of the next irrigation. I understand that this might be completely not interesting for many but for me is :)
That is why - on hourly basis - I would like to get queue_sensor (sensor.wb_irrigation_pX) updated and also do maths for irrigation_time_min and pass result to manual_duration (input_number.wbi_pX_duration) to make is visible in UI.

so if you can accept the fact that I'm unusually curious :) guide me please with your preferred approach to achieve above and I will try to make appropriate changes in the code. I'm not a programmer so it takes me a while to understand things .. sorry for that :)

re accumulator (wbi_pX_hours) ... Accumulator for me works strange as wrote earlier (after HA restart it is counting even if switch is off) so I do not use it (I replaced by platform: history_stats) ... further even if I look at attributes of this sensor i have no clue how could I extract next calculated irrigation time from the variable wbi_pX_hours as you suggested above.

image

@hhaim

hhaim commented Apr 23, 2020

Copy link
Copy Markdown
Owner

My main goal is to see how the elapsed time and weather conditions affecting the calculated time of the next irrigation.
This is exactly wbi_irrigation_px (queue level)

image

The hours sensor just take the value. It is accumulation of time (hours) of irrigation

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

Successfully merging this pull request may close these issues.

2 participants