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

Met Office - value needs to have a number #90

Open
2 tasks done
DustyArmstrong opened this issue Jun 4, 2023 · 6 comments
Open
2 tasks done

Met Office - value needs to have a number #90

DustyArmstrong opened this issue Jun 4, 2023 · 6 comments

Comments

@DustyArmstrong
Copy link

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
1.0.5
Last working release (if known):
N/A
Browser and Operating System:
Windows 10, Firefox 113.0.2

Occurs on all OS, configuration issue with card.

Description of problem:
When trying to configure the weather forecast max/min temperatures, error below is returned.

'entity_forecast_min_1=sensor.met_office_REDACTED_temperature_daily' value needs to have a number

Numerical value is provided by Met Office API, should be displayed as normal. Have tested this with other elements which do display the number correctly, this only appears to be an issue with the min/max on the forecast section.

I have tried to use other readings such as Met Office Daily but this returns a different error 'entity_forecast_min_1 attribute forecast[1].templow not found, though this one does arguably make sense if that specific reading is not sent by the API in that way.

It would be good if I can either disable the temperatures entirely (when the API doesn't provide the specific information it's looking for) or if there is a possible fix for this.

@DustyArmstrong DustyArmstrong added the bug Something isn't working label Jun 4, 2023
@DustyArmstrong
Copy link
Author

OK so it seems to be down to the fact that the Met Office readings do not include templow, so it's unable to display it correctly. Having the option to display just the temperature instead of high/low would be ideal, but in the meantime I will try to figure out a way to inject templow with an arbitrary reading from the normal temperature reading.

I suppose this is a feature request then rather than a bug, sorry!

@DavidFW1960 DavidFW1960 removed the bug Something isn't working label Jun 4, 2023
@DavidFW1960
Copy link
Collaborator

as a suggestion, use something like statistics integration (or the custom average component) to generate the high/low and point the entity in the card to that. Of course this is not a bug with the card but a deficiency in the weather integration you are using. The card can point to ANY entity you want it to BTW.

@DustyArmstrong
Copy link
Author

as a suggestion, use something like statistics integration (or the custom average component) to generate the high/low and point the entity in the card to that. Of course this is not a bug with the card but a deficiency in the weather integration you are using. The card can point to ANY entity you want it to BTW.

Thanks, I am trying to work out (with my limited skills) how I can just pass the temperature readings I do have through a separate entity. It's expecting an index with templow and temperature rather than just anything, otherwise it still fails with a different error entity_forecast_min_1 attribute forecast[1].templow not found.

@DavidFW1960
Copy link
Collaborator

Can you post a screenshot of the states for the weather entities here please. Is it a weather integration you are using or individual sensors? Also post the yaml code for the card config.

@DustyArmstrong
Copy link
Author

Thanks for getting back to me. I am using the Met Office integration, from the UK. I hope you don't mind, I have redacted my location for privacy. I use the Met Office one as it seems to be the most accurate.

As you can see below, the states summary only includes temperature, not templow and temperature. I have tested, and if I inject a templow: 0 to the state then I can add it to the card successfully. I'm not knowledgeable enough to know how to do this through the configuration, I'd be happy with that or just a new entity that I can create with the right temperature and templow readings created from this existing state.

I can of course access the reading(s) with:

{{ state_attr('weather.met_office_REDACTED_daily', 'forecast')[0]['temperature'] }}

I just don't know how to translate that into a new entity or inject templow to the existing state.

STATES

temperature: 16
temperature_unit: °C
humidity: 76
pressure_unit: hPa
wind_bearing: NE
wind_speed: 28.97
wind_speed_unit: km/h
visibility_unit: km
precipitation_unit: mm
forecast:
  - datetime: '2023-06-07T12:00:00+00:00'
    condition: sunny
    precipitation_probability: 4
    wind_bearing: ENE
    temperature: 18
    wind_speed: 28.97
  - datetime: '2023-06-08T12:00:00+00:00'
    condition: cloudy
    precipitation_probability: 4
    wind_bearing: ENE
    temperature: 17
    wind_speed: 28.97
  - datetime: '2023-06-09T12:00:00+00:00'
    condition: cloudy
    precipitation_probability: 12
    wind_bearing: ENE
    temperature: 18
    wind_speed: 25.75
  - datetime: '2023-06-10T12:00:00+00:00'
    condition: cloudy
    precipitation_probability: 34
    wind_bearing: NNE
    temperature: 19
    wind_speed: 14.48
attribution: Data provided by the Met Office
friendly_name: Met Office REDACTED Daily

CARD YAML

card_config_version: 8
custom1_icon: mdi:radar
custom1_value: sensor.met_office_REDACTED_weather_3_hourly
daily_forecast_days: 4
entity_apparent_temp: sensor.met_office_REDACTED_feels_like_temperature_3_hourly
entity_forecast_icon: weather.met_office_REDACTED_3_hourly
entity_forecast_icon_1: weather.met_office_REDACTED_daily
entity_forecast_max: weather.met_office_REDACTED_daily
entity_humidity: weather.met_office_REDACTED_3_hourly
entity_pop: sensor.met_office_REDACTED_probability_of_precipitation_3_hourly
entity_pop_1: weather.met_office_REDACTED_daily
entity_pos: sensor.met_office_REDACTED_probability_of_precipitation_3_hourly
entity_pressure: weather.met_office_REDACTED_daily
entity_summary_1: weather.met_office_REDACTED_daily
entity_sun: sun.sun
entity_temperature: sensor.met_office_REDACTED_temperature_3_hourly
entity_uv_alert_summary: sensor.met_office_REDACTED_uv_index_3_hourly
entity_wind_bearing: weather.met_office_REDACTED_3_hourly
entity_wind_speed: sensor.met_office_REDACTED_wind_speed_3_hourly
option_locale: GB
section_order:
  - overview
  - extended
  - slots
  - daily_forecast
show_section_daily_forecast: true
slot_l1: forecast_max
slot_l2: custom1
slot_l3: wind
slot_l4: remove
slot_l5: sun_next
slot_l6: remove
slot_l7: remove
slot_l8: remove
slot_r1: popforecast
slot_r2: humidity
slot_r3: uv_summary
slot_r4: remove
slot_r5: sun_following
slot_r6: remove
slot_r7: remove
slot_r8: remove
type: custom:platinum-weather-card

@DustyArmstrong
Copy link
Author

DustyArmstrong commented Jun 6, 2023

EDIT: so the number error is a result of the code checking for a number in the sensor name, not sure why. I have added a number to the sensor name, but now the card just disappears when I hit save.

I have done some testing, and was able to get the following attributes by using the below:

        tempfix:
            friendly_name: "tempfix"
            value_template: "sunny"
            attribute_templates:
                forecast: "{{ state_attr('weather.met_office_REDACTED_daily', 'forecast')[0]['temperature'], state_attr('weather.met_office_REDACTED_daily', 'forecast')[1]['temperature'], state_attr('weather.met_office_REDACTED_daily', 'forecast')[2]['temperature'], state_attr('weather.met_office_REDACTED_daily', 'forecast')[3]['temperature'] }}"
forecast:
  - 18
  - 17
  - 18
  - 19
friendly_name: tempfix

But even if I add in templow like my original API call, I still get the value needs to have a number error. I don't get this error however if I add in templow to the API output. What data is it expecting? I can't see any difference between them?

forecast:
  - templow: 18
  - templow: 17
  - templow: 18
  - templow: 19
friendly_name: tempfix
forecast:
  - datetime: '2023-06-07T12:00:00+00:00'
    condition: sunny
    precipitation_probability: 4
    wind_bearing: ENE
    temperature: 18
    templow: 18
    wind_speed: 28.97
  - datetime: '2023-06-08T12:00:00+00:00'
    condition: cloudy
    precipitation_probability: 4
    wind_bearing: ENE
    temperature: 17
    templow: 17
    wind_speed: 28.97
  - datetime: '2023-06-09T12:00:00+00:00'
    condition: cloudy
    precipitation_probability: 12
    wind_bearing: ENE
    temperature: 18
    templow: 18
    wind_speed: 25.75

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

2 participants