heyajohnny / cryptoinfo

Provides Home Assistant sensors for all cryptocurrencies supported by CoinGecko
GNU General Public License v3.0
49 stars 14 forks source link

Returns to ZERO #3

Closed phoniclynx closed 4 years ago

phoniclynx commented 4 years ago

When HA reboots the script makes the sensor value "0"... making the graphs that I am outputting using a template unreadable because the values range around the 4000 marks and the graph plummets to 0 making the variability of the graph unnoticeable

heyajohnny commented 4 years ago

I've just pushed an update that should fix it. Beware that you need to delete the history. The easiest way is to just delete the database file and restart HA. After that, it should be working flawlessly.

phoniclynx commented 4 years ago

Where do I find the database file?

On Wed, 17 Jun 2020 at 06:48, heyajohnny notifications@github.com wrote:

I've just pushed an update that should fix it. Beware that you need to delete the history. The easiest way is to just delete the database file and restart HA. After that, it should be working flawlessly.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/heyajohnny/cryptoinfo/issues/3#issuecomment-645017212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5UBEEGI5LQY2L7AVMXUPTRW7OSJANCNFSM4N557BVQ .

heyajohnny commented 4 years ago

It's in the main directory of Home Assistant. It's called 'home-assistant_v2.db'

phoniclynx commented 4 years ago

That didn't seem to fix the issue... I convert it using a template but the sensor when it starts is set to unknown.. then before it grabs the data from coingecko it sets a coin value to $0.00 then grabs each one, by one and sets is value. ... it's the $0.00 which breaks the graph. So whenever you reset HA after an update of configurations.yaml or upgrade of the software it sets all the values to 0 when I think it should be set to "unknown" or something so that the graphs don't get mangled.

heyajohnny commented 4 years ago

That is very strange... I can't reproduce your issue. When I restart my HA it sets the value to 'Unknown' and then gets the right value. Maybe if you upgrade your HA to the latest version it will be fixed. Or it has something to do with some system variables... I really don't know how I can reproduce / fix this.

phoniclynx commented 4 years ago

I'll show you the code I have:

On Sun, 21 Jun 2020 at 23:10, heyajohnny notifications@github.com wrote:

That is very strange... I can't reproduce your issue. When I restart my HA it sets the value to 'Unknown' and then gets the right value. Maybe if you upgrade your HA to the latest version it will be fixed. Or it has something to do with some system variables... I really don't know how I can reproduce / fix this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/heyajohnny/cryptoinfo/issues/3#issuecomment-647129862, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5UBECEAUKBBEGWOVZPGN3RXYETFANCNFSM4N557BVQ .

heyajohnny commented 4 years ago

Please try this for your template sensor:

  - platform: template
    sensors:
      crypto_bitcoin_owned:
        friendly_name: "Bitcoin Owned"
        unit_of_measurement: '$'
        value_template: >-
          {% if not is_state('sensor.cryptoinfo_bitcoin_aud', 'unknown') %}
            {{ (states('sensor.cryptoinfo_bitcoin_aud')|float *0.12345) | round(2) }}
          {%endif %}
heyajohnny commented 4 years ago

Did the code above fixed your issue?

phoniclynx commented 4 years ago

yes

On Wed, 24 Jun 2020 at 19:40, heyajohnny notifications@github.com wrote:

Did the code above fixed your issue?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/heyajohnny/cryptoinfo/issues/3#issuecomment-648729019, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5UBEF3474PQYKJXNX7ECTRYHGIZANCNFSM4N557BVQ .

heyajohnny commented 4 years ago

Oke :) I'm closing the issue.