Git Product home page Git Product logo

ha-oilfox's People

Contributors

chises avatar christophcaina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ha-oilfox's Issues

featureRequest - adding more sensors

Hi, I've just installed the OilFox integration - So I am not sure, if all sensors will be provided by the API directly - or some only on certain occasions... but I would like to get the following information from the Integration as well:

batteryLevel string, optional enum of the battery level, see below

Enum batteryLevel

name description
FULL Full battery level
GOOD Good battery level
MEDIUM Medium battery level
WARNING Low battery level
CRITICAL Critical battery level

and maybe also the Failure Information:

validationError string, optional enum with errors regarding the measurement, see below

Enum validationError

name description
NO_METERING No measurement yet
EMPTY_METERING Incorrect Measurement
NO_EXTRACTED_VALUE No fill level detected
SENSOR_CONFIG Faulty measurement
MISSING_STORAGE_CONFIG Storage configuration missing
INVALID_STORAGE_CONFIG Incorrect storage configuration
DISTANCE_TOO_SHORT Measured distance too small
ABOVE_STORAGE_MAX Storage full
BELOW_STORAGE_MIN Calculated filling level implausible

these are documented in the API documentation from OilFox:
https://github.com/foxinsights/customer-api/tree/main/docs/v1

Thanks a lot :)

New Sensors for LastUpdate & Next update

Until now, the sensors provided different information only as an attribute.
For example, the next update or last update timestamp was within the different sensors (for which I have then created template sensors)

    oilfox_kachelofen_updatetimeleft:
      value_template: >-
        {% set currentTime = as_timestamp(states('sensor.date_time_iso')) %}
        {% set nextUpdateTimestamp = as_timestamp(state_attr('sensor.oilfox_of7090001854_filllevelpercent', 'Next Measurement')) %}
        {% set timeLeft = nextUpdateTimestamp - currentTime  %}
        {% if timeLeft > 0 %}
          {% set minutes = (timeLeft / 60)|int % 60 %}
          {% set hours = (timeLeft / 3600)|int %}
          {{ '{:02}:{:02}'.format(hours, minutes) }}
        {% else %}
          00:00
        {% endif %}
      unit_of_measurement: hrs
    oilfox_kachelofen_lastupdate:
      value_template: >-
        {% set lastUpdateTimestamp = state_attr('sensor.oilfox_of7090001854_filllevelpercent', 'Last Measurement') %}
        {{ (as_timestamp(lastUpdateTimestamp)) | timestamp_custom('%d.%m.%Y - %H:%M' ) }}
      icon_template: mdi:update
    oilfox_kachelofen_nextupdate:
      value_template: >-
        {% set nextUpdateTimestamp = state_attr('sensor.oilfox_of7090001854_filllevelpercent', 'Next Measurement') %}
        {{ (as_timestamp(nextUpdateTimestamp)) | timestamp_custom('%d.%m.%Y - %H:%M' ) }}
      icon_template: mdi:update

After the last update, it seems that the attributes aren't longer available (Bugfix for #10 )
But it might be an idea, to implement own sensors for the last update and next update?

Can not restart HA due to last Oilfox update

I can not restart HA anymore, because I got the following error Message:

Platform error sensor.oilfox - Exception importing custom_components.oilfox.sensor

Thanks for YouTube help

Timeout data

Hi, sorry if this was already solved or i'm doing something wrong.

The integration itself is working, but it goes unavailable like every few hours. See in graphic below

grafik

This is from the log:

Logger: custom_components.oilfox.UpdateCoordinator
Source: helpers/update_coordinator.py:193
Integration: OilFox (documentation, issues)
First occurred: 12. April 2023 um 14:56:38 (31 occurrences)
Last logged: 19:18:04
Timeout fetching oilfox data

The Adapter on my tank sends an update every 24 hours also to the oilfox app, so is it because HA tries to often to check for an update? Is there a way to prevent this?

Many thanks!

Devices Unavailable since Februar 2024.2 Update

Oilfox Entity is reporting all devices as being unavailable on two different HA instances since update on 2024.2. App is working correctly, so most probably the update broke something. A fresh logon of the integration did not help either.

No Connection

Since a few days i lost connection, is there a change in the API ?

calling async_forward_entry_setups instead of async_setup_platforms

with recent HA Version, the log is throwing the following warning:

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for oilfox using this method at custom_components/oilfox/__init__.py, line 22: hass.config_entries.async_setup_platforms(entry, (Platform.SENSOR,))

after Update to v1.1.0 integration doesnt work

Der Konfigurationsfluss konnte nicht geladen werden: 500 Internal Server Error Server got itself in trouble this Error i will get after trying to add this integration. HA is still loading and after a few seconds this error message apears. I have no ideas what i can do.

Will it work with all kind of "Oilfox" ?

Hallo chises,
danke für deine Entwicklung, das hört sich sehr gut an. Lass mich bitte fragen, es gibt verschiedene Oilfox Varianten.
Ist es auch für diesen hier nutzbar:
https://www.baywa.de/de/haus-hof/tanken/diesel/baywa-oilfox-radar-digitaler-fuellstandsmesser-fuer-heizoel--und-dieseltanks-aus-kunststoff-ohne-tankoeffnung/p-000000000002078174/
ich habe keine Öffnung frei am Tank und müsste auf den Radar zurückgreifen, da er aber scheinbar in die Cloud senden müsste es doch gehen oder?

Hello chises,
thanks for your development, it sounds very good. Let me ask please, there are different Oilfox variants.
Is it also usable for this one:
https://www.baywa.de/de/haus-hof/tanken/diesel/baywa-oilfox-radar-digitaler-fuellstandsmesser-fuer-heizoel--und-dieseltanks-aus-kunststoff-ohne-tankoeffnung/p-000000000002078174/
I have no opening free on the tank and would have to resort to the radar, but since he seems to send to the cloud it would have to go or?
BR
oliver

Attributes are not updated without integration or HA restart

Values are not updated without a restart of Homeassistant or the integration.
Today is april 26th but the attributes in homeassitant are outdated (expecting to become a update on april 25th)
image

Working on a fix for this. That will be released at the end of this week.

FeatureRequest: Split sensors on device level

As an future improvement for the Integration, the Integration should use the "device" information from HomeAssistant.

Right now, it will create entities without any assignment to a device:
grafik

In my case, I do have two Sensors - and it would be nice, if the integration could differenciate between them.
In that case - it would show: "2 devices - 14 Entities" - 7 for each device.

Since each sensor does provide a "unique" device identifier with its name, it should be not too difficult to assign the devices...

Device 1 (of7090001854)
grafik

Device 2 (of7090002028)
grafik

The naming of the sensors would be pretty much the same, I guess...

fuel_used -> statistics about your oil usage ... template or within the integration?

Hi,
Maybe, you can provide some support on the following?

Since I am using the Oilfox (which is for over a year now) - my intention was to get an information not about how much oil is left in the tanks, but about the Oil Usage itself.

For this, I have created Sensor Templates, which are calculating the usage based on the fill level of the tank - and the value how much the tank can acutally store.

Unfortunately, this is always causing issues, whenever the connection to the cloud has failed, as you can see in the following screenshot with the history...
grafik

Another issue is, the Template Sensor is using "Measurement" as state_class, which is throwing a warning in my logs, because the State_Class should either be total - or total_increasing... but this will cause further issues within the Statistics whenever such a wrong calculation happens.

Your Integration does already provide a sensor for the kWh (energy usage) - and I know, that this sensor will not be provided by the cloud-platform itself - so you are calculating this within your integration...

So would it be possible, to do a similar thing for the oil usage itself?

I am not sure, but maybe the API is already providing such information, because the APP does have information about how much Oil you have used per week / month / year... I'm not sure, if this calculation will be done within the app (where you have calculated the max volume of your tank)

In theory, you could just "invert" the values from filllevel -> this is decreasing with each measurement - and therefore, the fuel_used should increase by the same amount ... (but this might cause a conflict, when the tank will be refilled ?)

If that's not possible, maybe you have an idea on how to improve my template sensor to overcome such peaks?

- sensor:
    - name: oilfox_of7090002028_fuelused
      unique_id: "oilfox_of7090002028_fuelused"
      unit_of_measurement: L
      device_class: volume_storage
      state_class: measurement            # this should be total or total_increasing
      state: >
        {% set max_of7090002028_filllevel = 3000 | float(0) %}       # the max capacity of the tank(s)
        {% set current_of7090002028_filllevel = states('sensor.oilfox_of7090002028_filllevelquantity') | float(0) %}
        {% set of7090002028_fuelused = max_of7090002028_filllevel - current_of7090002028_filllevel | float(0) %}
        {{ '{:.2f}'.format(of7090002028_fuelused) }}
      availability: >
        {{ states('sensor.oilfox_of7090002028_filllevelquantity') not in ['Unknown', 'Unavailable', 'None'] }}

deprication warning with HA 2024.1.0b0

with HA 2024.1.0b0 the following Deprication warning will be raised:

TIME_DAYS was used from oilfox, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTime.DAYS instead, please create a bug report at https://github.com/chises/ha-oilfox/issues
ENERGY_KILO_WATT_HOUR was used from oilfox, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfEnergy.KILO_WATT_HOUR instead, please create a bug report at https://github.com/chises/ha-oilfox/issues
TEMP_CELSIUS was used from astroweather, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.CELSIUS instead, please create a bug report at https://github.com/mawinkler/astroweather/issues

This issue should be fixed with PR #43

Problems with actual HA Version 2022.04.6

Hello,

thanks for your work on the oilfox integration :-)

As it seems there is a problem with the new version of HA ?

Dont know if this is an error that occures when connection failes or what ever.

File "/config/custom_components/oilfox/sensor.py", line 49, in setup_platform entities.append(OilFoxSensor(OilFox(email, password, item['hwid'])))
File "/config/custom_components/oilfox/sensor.py", line 140, in init self.OilFox.updateStats()
File "/config/custom_components/oilfox/sensor.py", line 81, in updateStats self.daysReach = response.json()['daysReach']
KeyError: 'daysReach'

Maybe you can see whats the problem there ?

As i see in your source code there is no option if the connection fails to set the sensors to NAN or something like that ? My Phyton knowledge is not that good so maybe i am wrong.

Greetings from Austria

Kilowatt

unknown entity "UsageCounter"

Hi chises.
I'm deeply impressed about your work. Great! Thanks!
I realised that I have an entity called Usage Counter with a given value in kWh, which I can't find in the OilFoxAPI and also not in the classic download file via Oilfox App. May you explain what it is?
Best, Dieter
oilfox_entities

issues with sensor values after recent update

Hi :)
After the recent issue I've noticed some strange issues with the integration...
Sometimes, the sensor: filllevelquantity seems to receive a wrong value - and is then resetting again to the correct value:

grafik

grafik

grafik

The strange thing here is:
"Kachelofen" is only a 1000 L tank...

I am using a second Oilfox sensor for another tank - which is 3 times 1000 L (3000L in total) - where I cannot see this behave:
grafik

Anyway - I have created utility meters for both sensors - to count the monthly and yearly usage... and this behave does affect the statistics / value of these sensors.

3000 L tank - monthly usage:
grafik

3000 L tank - yearly usage:
grafik

1000 L tank - monthly usage:
grafik

1000 L tank - yearly usage:
grafik

Probably - this could be related due to the move to the config flow?

Side-Node:
Validation Error does not have any state now
grafik

integration failed, timeout parameter, since update 2024-01-03

Solved with V 1.16 and pull request #53

Hi chises,
I think something in HA changed because of the message in the screenshot and because it worked well before (except missing data caused by WLAN connection sometimes).
Thanks for your great integration,
Dieter

oilfox1

`Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.oilfox.UpdateCoordinator
Source: helpers/update_coordinator.py:300
Integration: OilFox (documentation, issues)
First occurred: 3. Februar 2024 um 22:29:06 (860 occurrences)
Last logged: 17:39:59

Unexpected error fetching oilfox data: ValueError("timeout parameter cannot be of <class 'int'> type, please use 'timeout=ClientTimeout(...)'")
Traceback (most recent call last):
File "/config/custom_components/oilfox/UpdateCoordinator.py", line 37, in _async_update_data
await self.oilfox_api.update_stats()
File "/config/custom_components/oilfox/OilFox.py", line 62, in update_stats
async with aiohttp.ClientSession(timeout=self.TIMEOUT) as session:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 292, in init
raise ValueError(
ValueError: timeout parameter cannot be of <class 'int'> type, please use 'timeout=ClientTimeout(...)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/oilfox/UpdateCoordinator.py", line 39, in _async_update_data
raise ConfigEntryNotReady(repr(err))
homeassistant.exceptions.ConfigEntryNotReady: ValueError("timeout parameter cannot be of <class 'int'> type, please use 'timeout=ClientTimeout(...)'")
`

broken after update HA to 2024.1.6

After update HA to 2024.1.6 it wont work.

Setup failed for custom integration 'oilfox': Requirements for oilfox not found: ['aiohttp==3.9.1'].
13:01:02 – (FEHLER) setup.py
Unable to install package aiohttp==3.9.1: ERROR: Cannot install aiohttp==3.9.1 because these package versions have conflicting dependencies. ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
13:01:02 – (FEHLER) util/package.py - Die Nachricht ist zum ersten Mal am 13:00:58 aufgetreten und erscheint 3 mal

After update to HA 2024.1.6 Intgeration does not initialize

Integration is in an initailizing loop.
Debug log shows:
``
2024-02-02 14:01:16.407 ERROR (MainThread) [custom_components.oilfox.UpdateCoordinator] Unexpected error fetching oilfox data: ValueError("timeout parameter cannot be of <class 'int'> type, please use 'timeout=ClientTimeout(...)'")
Traceback (most recent call last):
File "/config/custom_components/oilfox/UpdateCoordinator.py", line 37, in _async_update_data
await self.oilfox_api.update_stats()
File "/config/custom_components/oilfox/OilFox.py", line 62, in update_stats
async with aiohttp.ClientSession(timeout=self.TIMEOUT) as session:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 292, in init
raise ValueError(
ValueError: timeout parameter cannot be of <class 'int'> type, please use 'timeout=ClientTimeout(...)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/oilfox/UpdateCoordinator.py", line 39, in _async_update_data
raise ConfigEntryNotReady(repr(err))
homeassistant.exceptions.ConfigEntryNotReady: ValueError("timeout parameter cannot be of <class 'int'> type, please use 'timeout=ClientTimeout(...)'")
2024-02-02 14:01:18.020 ERROR (SyncWorker_5) [homeassistant] Error doing job: Unclosed client session
2024-02-02 14:01:41.199 DEBUG (MainThread) [custom_components.oilfox.OilFox] Update Refresh and Access Token: ok
2024-02-02 14:01:41.202 DEBUG (MainThread) [custom_components.oilfox.OilFox] Update Refresh Token: True
2024-02-02 14:01:41.203 ERROR (MainThread) [custom_components.oilfox.UpdateCoordinator] Unexpected error fetching oilfox data: ValueError("timeout parameter cannot be of <class 'int'> type, please use 'timeout=ClientTimeout(...)'")
Traceback (most recent call last):
File "/config/custom_components/oilfox/UpdateCoordinator.py", line 37, in _async_update_data
await self.oilfox_api.update_stats()
File "/config/custom_components/oilfox/OilFox.py", line 62, in update_stats
async with aiohttp.ClientSession(timeout=self.TIMEOUT) as session:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 292, in init
raise ValueError(
ValueError: timeout parameter cannot be of <class 'int'> type, please use 'timeout=ClientTimeout(...)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/oilfox/UpdateCoordinator.py", line 39, in _async_update_data
raise ConfigEntryNotReady(repr(err))
homeassistant.exceptions.ConfigEntryNotReady: ValueError("timeout parameter cannot be of <class 'int'> type, please use 'timeout=ClientTimeout(...)'")
2024-02-02 14:01:41.213 DEBUG (MainThread) [custom_components.oilfox.UpdateCoordinator] Finished fetching oilfox data in 0.090 seconds (success: False)
2024-02-02 14:01:41.589 ERROR (SyncWorker_10) [homeassistant] Error doing job: Unclosed client session
``

After update today 0.1.11 it wont work again

Logger: homeassistant.components.sensor
Source: custom_components/oilfox/sensor.py:159
Integration: Sensor (documentation, issues)
First occurred: 06:08:14 (1 occurrences)
Last logged: 06:08:14

Error while setting up oilfox platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/oilfox/sensor.py", line 159, in async_setup_entry
oilfox_devices = coordinator.data["items"]
TypeError: 'NoneType' object is not subscriptable

Fix incorrect sensor values for usageCounterQuantity ?

This used to be a daily reading of usage values between 7 and 12 liters.

It went through the roof one day due to an incorrect value, which I could invalidate in the OilFox app.

It's still in the sensor, though, and my (really useful) usage history is no more.

Is there any way to fix this?

image

Sensor Updates

Hi, since I have your Integration running,
I've noticed that the Sensors do not refresh / Update their readings regulately.

I have to reload the Integration every now and then to Update their readings.

Since OilFox does one Scan every 24hrs it would be great, of the Integration could try to read the API every time when the Date / time from the Attribute 'next update' has been reached / past.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.