neiam
/lambent_ex
Lambent Aether 5
public · Issues · Pulls 1 · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
Read the devices' JSON with Jason, and let decimal move to 3
42cea84 · Gabriel Morell · 2026-10-23 06:08
Message
{commit_body(@commit)}
Files changed
modified
lib/lambent_ex/mqtt.ex
+3
−3
@@ -305,7 +305,7 @@ defmodule LambentEx.MQTT.Handler do
| 305 | 305 | |
| 306 | 306 | ["tele", device, "STATE"] -> |
| 307 | 307 | Logger.info("#{device}: got STATE, updating device states, #{payload}") |
| 308 | − {:ok, p} = Poison.decode(payload) | |
| 308 | + {:ok, p} = Jason.decode(payload) | |
| 309 | 309 | |
| 310 | 310 | if is_lighting_entity?(:p, p) do |
| 311 | 311 | publish_entity(state[:id], :light, device, p) |
@@ -325,14 +325,14 @@ defmodule LambentEx.MQTT.Handler do
| 325 | 325 | |
| 326 | 326 | ["stat", device, "RESULT"] -> |
| 327 | 327 | Logger.info("#{device}: got RESULT message, #{payload}") |
| 328 | − {:ok, p} = Poison.decode(payload) | |
| 328 | + {:ok, p} = Jason.decode(payload) | |
| 329 | 329 | |
| 330 | 330 | if is_lighting_entity?(:p, p) do |
| 331 | 331 | publish_entity(state[:id], :light, device, p) |
| 332 | 332 | end |
| 333 | 333 | |
| 334 | 334 | [root, "audio", device, kind] when kind in ["fft", "peaks", "beat"] -> |
| 335 | − case Poison.decode(payload) do | |
| 335 | + case Jason.decode(payload) do | |
| 336 | 336 | {:ok, p} -> Process.send(state[:id], {:audio, root, device, kind, p}, []) |
| 337 | 337 | {:error, _reason} -> Logger.debug("#{device}: unreadable #{kind}, #{payload}") |
| 338 | 338 | end |
modified
lib/lambent_ex/scan/8266-7777.ex
+1
−1
@@ -377,7 +377,7 @@ defmodule LambentEx.Scan.ESP8266x7777 do
| 377 | 377 | 218 -> |
| 378 | 378 | IO.inspect({"218@", ip}) |
| 379 | 379 | |
| 380 | − case resp.body |> Poison.decode(keys: :atoms) do | |
| 380 | + case resp.body |> Jason.decode(keys: :atoms) do | |
| 381 | 381 | {:ok, json} -> |
| 382 | 382 | {:lambent, ip, json.udp_sox |> length, indicator_port(json), version(json)} |
| 383 | 383 |
modified
mix.exs
+0
−1
@@ -59,7 +59,6 @@ defmodule LambentEx.MixProject do
| 59 | 59 | {:telemetry_poller, "~> 1.0"}, |
| 60 | 60 | {:gettext, "~> 0.20"}, |
| 61 | 61 | {:jason, "~> 1.2"}, |
| 62 | − {:poison, "~> 5.0"}, | |
| 63 | 62 | {:plug_cowboy, "~> 2.5"}, |
| 64 | 63 | # |
| 65 | 64 | {:req, "~> 0.7.5"}, |
modified
mix.lock
+1
−2
@@ -3,7 +3,7 @@
| 3 | 3 | "cowboy": {:hex, :cowboy, "2.18.0", "bff388eb4d6356cb3f88c26e65b515976bf04b401b805d31550c3e60eba8fe18", [:make, :rebar3], [{:cowlib, ">= 2.19.0 and < 3.0.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, ">= 1.8.0 and < 3.0.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "62d0b26abcf455054972b0da242389c69d5982ce5914afb8c344517f667b9600"}, |
| 4 | 4 | "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, |
| 5 | 5 | "cowlib": {:hex, :cowlib, "2.21.0", "3ea757c79784bdbdebac7857ce3adf2290af6b8680d4248c75e40ced2e98c89e", [:make, :rebar3], [], "hexpm", "0960248773762a5319b3c17285028bc76f54f58ef0f9451367401bdf67b46274"}, |
| 6 | − "decimal": {:hex, :decimal, "2.4.1", "6c0fbede12fb122ba685e9ab41c6a40c129e322b3aa192f9e072e61f3a6ffaf2", [:mix], [], "hexpm", "7e618897933a8455f19a727d7c5e50a2c071a544b700e5e724298ecb4340187f"}, | |
| 6 | + "decimal": {:hex, :decimal, "3.2.0", "f1235f05d841a211fda78a08fdb9777f2ff51a71f18455233fae186ff76187c6", [:mix], [], "hexpm", "190bca80580ce61aa69bb0eacadd7677710205c770225c2c2c07e32a5c31b234"}, | |
| 7 | 7 | "ecto": {:hex, :ecto, "3.13.6", "352135b474f91d1ab99a1b502171d207e9db60421c9e3d0ecab4c7ab96b24d14", [:mix], [{:decimal, "~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "8afa059bc16cd2c94739ec0a11e3e5df69d828125119109bef35f20a21a76af2"}, |
| 8 | 8 | "eqrcode": {:hex, :eqrcode, "0.2.1", "d12838813e8fc87b8940cc05f9baadb189031f6009facdc56ff074375ec73b6e", [:mix], [], "hexpm", "d5828a222b904c68360e7dc2a40c3ef33a1328b7c074583898040f389f928025"}, |
| 9 | 9 | "esbuild": {:hex, :esbuild, "0.10.0", "b0aa3388a1c23e727c5a3e7427c932d89ee791746b0081bbe56103e9ef3d291f", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "468489cda427b974a7cc9f03ace55368a83e1a7be12fba7e30969af78e5f8c70"}, |
@@ -36,7 +36,6 @@
| 36 | 36 | "plug": {:hex, :plug, "1.20.3", "56c480c633ec2ce10140e236e15233bf576e1d323887d7c96711bd02ab5160db", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "be266aee1b8536ef6409d58cf39a3121319f0ec47cfa1b24024485aa0e76ad76"}, |
| 37 | 37 | "plug_cowboy": {:hex, :plug_cowboy, "2.9.0", "87e21e0d9054ced99c36d128f49e3ea2cd8b745fffb97de50bff99706087af4f", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.18", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "2002bafba4f3a45b55a58e68d70211b153a7ed18d37edb1ceb6e96e7a92c422e"}, |
| 38 | 38 | "plug_crypto": {:hex, :plug_crypto, "2.2.0", "144014737daaf485407f5ed77daeaad74d651b216a28c87543f8cc7043f8efc8", [:mix], [], "hexpm", "83a95744ab1c75876542b6fab135fcc176280e0f301a111c1f757fddcec95d2c"}, |
| 39 | − "poison": {:hex, :poison, "5.0.0", "d2b54589ab4157bbb82ec2050757779bfed724463a544b6e20d79855a9e43b24", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "11dc6117c501b80c62a7594f941d043982a1bd05a1184280c0d9166eb4d8d3fc"}, | |
| 40 | 39 | "porcelain": {:hex, :porcelain, "2.0.3", "2d77b17d1f21fed875b8c5ecba72a01533db2013bd2e5e62c6d286c029150fdc", [:mix], [], "hexpm", "dc996ab8fadbc09912c787c7ab8673065e50ea1a6245177b0c24569013d23620"}, |
| 41 | 40 | "procket": {:hex, :procket, "0.9.10", "21824fa3881377754238a7a2e08b7865350ce3fa2cde8be54872806b9cdbb6bb", [:rebar3], [], "hexpm", "b73a8e31f8395bea90a5b27f95fdf32de81fd8097aa51709d18bbf85db04c9ba"}, |
| 42 | 41 | "ranch": {:hex, :ranch, "2.2.1", "fc2bb0e800efbeab8ff82eb325450b9c08653b14c3f69e8b09bbea304973105d", [:make, :rebar3], [], "hexpm", "55f05cce20ec2da1d90de5d5981afb93dbfc01325fc7e933189aa5c62f037c24"}, |
modified
test/lambent_ex/fft_test.exs
+1
−1
@@ -175,7 +175,7 @@ defmodule LambentEx.FFTTest do
| 175 | 175 | |
| 176 | 176 | describe "mqtt" do |
| 177 | 177 | test "the handler hands analyser readings to its broker" do |
| 178 | − json = Poison.encode!(peaks(@silent)) | |
| 178 | + json = Jason.encode!(peaks(@silent)) | |
| 179 | 179 | |
| 180 | 180 | LambentEx.MQTT.Handler.handle_message( |
| 181 | 181 | ["neiam", "audio", "a1b2c3", "peaks"], |
Parents: 12e1285