feat(ha): publish weather data
All checks were successful
Build / build (push) Successful in 5m2s

This commit is contained in:
Daniel Kempkens 2024-08-13 21:22:18 +02:00
parent 107e7d0b5a
commit f629f4a019
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
3 changed files with 6 additions and 3 deletions

View file

@ -23,7 +23,8 @@ defmodule WeewxProxy.HTTP.Ecowitt do
sdr_keys = Sdr.recently_uploaded_keys(data.dateTime)
_ = Logger.debug("Removing keys: `#{inspect(sdr_keys)}'")
partial_data = Map.drop(data, sdr_keys)
Publisher.publish("weewx/ingest_us", partial_data)
:ok = Publisher.publish("weewx/ingest_us", partial_data)
Publisher.publish_value_map("hadata/weewx/us", partial_data)
else
_ = Logger.error("Not publishing record because data appears invalid: #{inspect(data)}")
:ok

View file

@ -136,7 +136,8 @@ defmodule WeewxProxy.HTTP.PurpleAir do
}
_ = :ets.insert(:purpleair, {:last_update, transformed_data.dateTime})
Publisher.publish("weewx/ingest_si", transformed_data)
:ok = Publisher.publish("weewx/ingest_si", transformed_data)
Publisher.publish_value_map("hadata/weewx/si", transformed_data)
end
@spec format_date_time(parsed_body()) :: non_neg_integer()

View file

@ -141,7 +141,8 @@ defmodule WeewxProxy.Sdr.Ecowitt do
partial_data = Map.drop(data, purpleair_keys)
true = :ets.insert(:sdr_ecowitt, {{type, :last_update}, data.dateTime})
Publisher.publish("weewx/ingest_si", partial_data)
:ok = Publisher.publish("weewx/ingest_si", partial_data)
Publisher.publish_value_map("hadata/weewx/si", partial_data)
else
_ = Logger.error("Not publishing record because data appears invalid: #{inspect(data)}")
:ok