Car Wash Binary Sensor

This component checks the weather forecast for several days in advance and concludes whether it is worth washing the car now.

This sensor should work with any weather providers in any of their settings. But please note that the sensor cannot see further than the weather provider shows. Therefore, it is recommended to set the daily mode in the weather provider settings. If necessary, you can configure a separate weather provider instance especially for this sensor.

9 Likes

Love it

can show me how darky_Sky to it

look at the code

        for fc in forecast:
            if fc.get(ATTR_FORECAST_TIME)[:10] == stop_date:
                break      

            if fc.get(ATTR_FORECAST_PRECIPITATION):
                self._state = False
                return
            if t < 0 and fc.get(ATTR_FORECAST_TEMP_LOW) is not None:
                t = fc.get(ATTR_FORECAST_TEMP_LOW)
                if t >= 0:
                    self._state = False
                    return
            if t < 0 and fc.get(ATTR_FORECAST_TEMP) is not None:
                t = fc.get(ATTR_FORECAST_TEMP)
                if t >= 0:
                    self._state = False
                    return

        self._state = True

think I have to be changing this a
even just the manual where to start reading.

Hello, Stephan!

You do not need to change anything in the sensor code. Just set your weather provider in configs.

# Example configuration.yaml entry
weather:
  - platform: darksky
    api_key: YOUR_API_KEY

binary_sensor:
  - platform: car_wash
    weather: weather.dark_sky
1 Like

Yeap That was easy

1 Like

I’m too lazy to make difficult decisions :wink:

Hi and thanks for this.
On HA 0.91.2 I get the following error:

2019-04-09 16:37:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for binary_sensor.car_wash fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 377, in async_device_update
    await self.async_update()
  File "/home/homeassistant/.homeassistant/custom_components/car_wash/binary_sensor.py", line 111, in async_update
    wd = self._hass.states.get(self._weather_entity).attributes
AttributeError: 'NoneType' object has no attribute 'attributes'

- platform: car_wash
  weather: weather.dark_sky

Thanks again!!

Please, show configs for weather.dark_sky or send it to me via private message.

homeassistant:
  customize_glob:
    sensor.dark_sky_temperature:
      friendly_name: Temperatura
    sensor.dark_sky_humidity:
      friendly_name: UmiditĂ 
    sensor.dark_sky_wind_speed:
      friendly_name: VelocitĂ  Vento
    sensor.dark_sky_precip_intensity:
      friendly_name: IntensitĂ  Precipitazioni
    sensor.dark_sky_precip_probability:
      icon: mdi:weather-lightning-rainy
      friendly_name: ProbabilitĂ  Precipitazioni

#### SENSOR
sensor:
  - platform: darksky
    api_key: !secret darksky_api_key
    latitude: 41.8459971 # mettete le vostre coordinate
    longitude: 12.4528424 # mettete le vostre coordinate
    language: it
    forecast:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5
      - 6
      - 7
    hourly_forecast:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5
      - 6
    monitored_conditions:
      - icon
      - summary
      - nearest_storm_distance
      - nearest_storm_bearing
      - humidity
      - temperature
      - temperature_high
      - temperature_low
      - apparent_temperature
      - apparent_temperature_high
      - apparent_temperature_low
      - wind_speed
      - wind_bearing
      - precip_type
      - precip_probability
      - precip_accumulation
      - precip_intensity
      - precip_intensity_max
      - uv_index
      - hourly_summary
      - daily_summary
      - pressure
      - visibility
    scan_interval:
      days: 0
      hours: 1
      minutes: 0
      seconds: 0
      milliseconds: 0

It’s a sensors, not weather provider.
Weather provider has configs like

# Example configuration.yaml entry
weather:
  - platform: darksky
    api_key: YOUR_API_KEY

You are right, my mistake.
Many thanks anyway.

This looks pretty cool and may give it a try.
Does it take temperature as a consideration?
It could be sunny for the next 5 days, but if the temperature drops below 32 degrees F or 0 Celcius, It may not be a good idea as the doors and locks may freeze.

Ciao, Federico!

No, thank you for pointing to a place where, I believe, will often cause difficulties for other people. I will now make a revised version of the script, taking into account this moment.

E andrò, in questa occasione, a stappare una bottiglia di Montepulciano d’Abruzzo :wink:

Hello, Bernard!

Yes, the sensor takes into account the temperature. But now it takes into account only the conditions under which the car can quickly become dirty on the road.

It is difficult to take into account the factors of freezing parts. For example, I live in Russia and in our city the last cold weather is predicted on May 3rd … I don’t have to wash my car for half a year now?

We solve this problem simply: in the cold season, we wash the car with warm water, after which we immediately blow important parts with compressed air. Such as the mechanisms of rear-view mirrors and door locks.
I’m not sure that it will be useful for everyone to take into account the low temperature factor.

But about the temperature in Fahrenheit - thanks! Now the sensor believes that the temperature is always indicated in Celsius. I’ll think about how to fix this moment.

That would be great if you could accommodate Fahrenheit degrees, I am in the US.

Also can you clarify how the sensor works? If it’s “On” does it mean that it’s OK to wash the car? If this is the case, It may not be working well for me. My sensor shows “On” and it’s currently snowing like crazy here!! Not the best time to wash the car . :slight_smile:

Ottima scelta!!
:grinning:

1 Like

I’ve done it yesterday. But for now only in beta-version in develop branch of repository.
You can test new version of script just now, download it from here

For now sensor checks the weather for every day (today and some days forward) for:

  • Temperature transition through zero in Celsius (the moment when snow melts on the roads)
  • Precipitation. All analysis methods available in the weather provider are used: by weather conditions and by precipitation intensity

Also in the last edit I added checks for precipitation in the current weather.

Great … .thanks for the update. I’ll give it a shot today.

Awesome! Works for me! But i only see “On” and not like it’s oke to wash the car.
Also my icon is yellow. Maybe it’s better to change the color of the icon to green if it’s oke to wash your car and to red if it’s not oke.

Same here only on and off

Then by putting the it into a automation

turn the pouch light Blue when its on.

or

- id: 'Tell me when I can Clear the Car'
  alias: Tell me when I can Clear the Car
  trigger:
  - entity_id: binary_sensor.car_wash
    platform: state
    from: off
    to:on
  action:
  - data_template:
      title: "Home Assistant"
      message: "You Should Plan to clean the car."
    service: notify.stephan_phone

un test wrote off top of head

1 Like