Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/AppDaemon/appdaemon into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
acockburn committed Jun 28, 2023
2 parents f1502b2 + 49eb372 commit 02a45c3
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4.3.0
uses: docker/metadata-action@v4.4.0
with:
images: ${{ env.IMAGE_NAME }}
# Customize the generation of Docker `latest` tag
Expand Down
19 changes: 8 additions & 11 deletions appdaemon/plugins/mqtt/mqttplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,12 @@ def mqtt_on_message(self, client, userdata, msg):

if topic not in self.mqtt_binary_topics and wildcard not in self.mqtt_binary_topics:
# the binary data is not required
payload = payload.decode()
try:
payload = payload.decode()
except UnicodeDecodeError as u:
self.logger.info(f"Unable to decode MQTT message from topic {topic}, ignoring message")
self.logger.error(f"Unable to decode MQTT message from topic {topic}, with error: {u}")
return

data.update({"wildcard": wildcard, "payload": payload})

Expand All @@ -281,18 +286,10 @@ def mqtt_on_message(self, client, userdata, msg):
}

self.loop.create_task(self.send_ad_event(event_data))

except UnicodeDecodeError:
self.logger.info("Unable to decode MQTT message")
self.logger.error(
"Unable to decode MQTT message, with Traceback: %s",
traceback.format_exc(),
)
except Exception as e:
self.logger.critical("There was an error while processing an MQTT message: {} {}".format(type(e), e))
self.logger.critical(f"There was an error while processing MQTT message: {type(e)} {e}")
self.logger.error(
"There was an error while processing an MQTT message, with Traceback: %s",
traceback.format_exc(),
f"There was an error while processing MQTT message, with Traceback: {traceback.format_exc()}"
)

def mqtt_subscribe(self, topic, qos):
Expand Down
63 changes: 63 additions & 0 deletions appdaemon/widgets/pirateweather.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
widget_type: baseweather
fields:
title: ""
show_forecast: 0
prefer_icons: 0
unit: ""
wind_unit: ""
pressure_unit: ""
rain_unit: ""
temperature: ""
humidity: ""
precip_probability: ""
precip_intensity: ""
precip_type: ""
wind_speed: ""
pressure: ""
wind_bearing: ""
apparent_temperature: ""
icon: ""
bearing_icon: "mdi-rotate-0"
precip_type_icon: "mdi-umbrella"
forecast_title: ""
forecast_temperature_min: ""
forecast_temperature_max: ""
forecast_icon: ""
forecast_precip_probability: ""
forecast_precip_type: ""
forecast_precip_type_icon: "mdi-umbrella"
forecast_wind_speed: ""
forecast_wind_bearing: ""
forecast_bearing_icon: "mdi-rotate-0"
entities:
icon: sensor.pirateweather_icon
temperature: sensor.pirateweather_temperature
apparent_temperature: sensor.pirateweather_apparent_temperature
humidity: sensor.pirateweather_humidity
precip_probability: sensor.pirateweather_precip_probability
precip_intensity: sensor.pirateweather_precip_intensity
precip_type: sensor.pirateweather_precip
pressure: sensor.pirateweather_pressure
wind_speed: sensor.pirateweather_wind_speed
wind_bearing: sensor.pirateweather_wind_bearing
forecast_icon: sensor.pirateweather_icon_1d
forecast_temperature_min: sensor.pirateweather_overnight_low_temperature_1d
forecast_temperature_max: sensor.pirateweather_daytime_high_temperature_1d
forecast_precip_probability: sensor.pirateweather_precip_probability_1d
forecast_precip_type: sensor.pirateweather_precip_1d
forecast_wind_speed: sensor.pirateweather_wind_speed_1d
forecast_wind_bearing: sensor.pirateweather_wind_bearing_1d
css: []
static_css:
title_style: $weather_sub_style
unit_style: $weather_unit_style
main_style: $weather_main_style
sub_style: $weather_sub_style
sub_unit_style: $weather_sub_style
widget_style: $weather_widget_style
icons:
snow: mdi-snowflake
rain: mdi-umbrella
sleet: mdi-weather-snowy-rainy
unknown: mdi-umbrella
static_icons: []
106 changes: 101 additions & 5 deletions docs/DASHBOARD_CREATION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1934,6 +1934,95 @@ Style Arguments:
- ``title2_style``
- ``state_text_style``


pirateweather
~~~~~~~~~~~~~
.. figure:: images/weather.png
:alt: pirateweather

Up to date weather reports. By default, it's configured to work with pirateweather
sensors. To use all the features, you need to add these sensors to the
``Monitored conditions`` option in the configuration for the Home Assistant
Pirate Weather integration:

- Icon
- Precipitation Type
- Precipitation Intensity
- Precipitation Probability
- Temperature
- Apparent Temperature
- Humidity
- Wind Speed
- Wind Bearing
- Pressure

To have the forecast displayed set ``show_forecast`` to 1. For it to work you
additionally need to add 1 to the ``Daily forecasts sensors`` option in the configuration
for the Home Assistant Pirate Weather integration. To use all the forecast features, you
need to add these sensors to monitored_conditions:

- Temperature High
- Temperature Low

.. code:: yaml
forecast:
- 1
Mandatory arguments:
^^^^^^^^^^^^^^^^^^^^

None

Optional Arguments:
^^^^^^^^^^^^^^^^^^^

- ``title``
- ``show_forecast`` - show the forecast
- ``prefer_icons`` - use icons instead of text
- ``forecast_title`` - title of the forecast if enabled
- ``sensors`` - list of sensors used by the widget

You can change the entities used by the widget by overwriting their values
in the ``sensors`` key in configuration.

Example with default values:

.. code:: yaml
sample_weather:
widget_type: weather
title: Today
show_forecast: 1
prefer_icons: 1
forecast_title: Tomorrow
sensors:
icon: sensor.pirateweather_icon
temperature: sensor.pirateweather_temperature
apparent_temperature: sensor.pirateweather_apparent_temperature
humidity: sensor.pirateweather_humidity
precip_probability: sensor.pirateweather_precip_probability
precip_intensity: sensor.pirateweather_precip_intensity
precip_type: sensor.pirateweather_precip
pressure: sensor.pirateweather_pressure
wind_speed: sensor.pirateweather_wind_speed
wind_bearing: sensor.pirateweather_wind_bearing
forecast_icon: sensor.pirateweather_icon_1
forecast_temperature_min: sensor.pirateweather_daily_low_temperature_1
forecast_temperature_max: sensor.pirateweather_daily_high_temperature_1
forecast_precip_probability: sensor.pirateweather_precip_probability_1
forecast_precip_type: sensor.pirateweather_precip_1
Style Arguments:
^^^^^^^^^^^^^^^^^^^

- ``widget_style``
- ``main_style``
- ``unit_style``
- ``sub_style``
- ``sub_unit_style``
- ``title_style``

radial
~~~~~~
.. figure:: images/radial.png
Expand Down Expand Up @@ -2309,8 +2398,6 @@ monitored_conditions:

- temperature
- apparent\_temperature
- temperature_min
- temperature_max
- humidity
- precip\_probability
- precip\_intensity
Expand All @@ -2321,14 +2408,23 @@ monitored_conditions:
- icon

To have the forecast displayed set ``show_forecast`` to 1. For it to work you
additionally, need to add the forecast option in dark_sky Home Assistant
configuration.
additionally need to add the forecast option in dark_sky Home Assistant
configuration:

.. code:: yaml
forecast:
- 1
To use all the forecast features, you need to add these
sensors to monitored_conditions:

- temperature_low
- temperature_high

Forecasts (1 day in the future) can be displayed for the weather icon, min
and max temperature, precipitation probability and precipitation type.

Mandatory arguments:
^^^^^^^^^^^^^^^^^^^^

Expand All @@ -2346,7 +2442,7 @@ Optional Arguments:
You can change the entities used by the widget by overwriting their values
in the ``sensors`` key in configuration.

Example with default values:
Example with default values plus wind forecast:

.. code:: yaml
Expand Down

0 comments on commit 02a45c3

Please sign in to comment.