I need to write in erlang an if statement with the condition to search this test "tele/folin-house-s1/SENSOR" in the tuples that I recevie. Below I insert the tuples I'm receiving:
{message,<<0,5,128,208,182,250,162,9,244,64,0,0,105,198,0,0>>,
1,<<"DVES_0DBFDB">>,
#{dup => false,retain => true},
#{username => undefined},
<<"tele/folin-house-s1/LWT">>,<<"Offline">>,
{1549,8794,985040}}.
{message,<<0,5,128,208,182,250,162,9,244,64,0,0,105,198,0,0>>,
1,<<"DVES_0DBFDB">>,
#{dup => false,retain => true},
#{username => undefined},
<<"tele/folin-house-s1/LWT">>,<<"Offline">>,
{1549,8794,985040}}.
{message,undefined,0,<<"733f0bfd-0741-4e55-bd14-ba10a156165f1549007325254">>,
#{dup => false,retain => false},
#{username => undefined},
<<"tele/folin-house-s1/SENSOR">>,
<<"{\"Time\":\"2018-12-18T22:37:00\",\"BME680\":{\"Temperature\":21.3,\"Humidity\":38.1,\"Pressure\":1021.4,\"Gas\":308.19},\"TempUnit\":\"C\"}">>,
{1549,8796,895335}}.
{message,undefined,0,<<"733f0bfd-0741-4e55-bd14-ba10a156165f1549007325254">>,
#{dup => false,retain => false},
#{username => undefined},
<<"tele/folin-house-s1/SENSOR">>,
<<"{\"Time\":\"2018-12-18T22:37:00\",\"BME680\":{\"Temperature\":21.3,\"Humidity\":38.1,\"Pressure\":1021.4,\"Gas\":308.19},\"TempUnit\":\"C\"}">>,
{1549,8803,302986}}.
I would to filter with an if statement only the tuple like this one:
{message,undefined,0,<<"733f0bfd-0741-4e55-bd14-ba10a156165f1549007325254">>,
#{dup => false,retain => false},
#{username => undefined},
<<"tele/folin-house-s1/SENSOR">>,
<<"{\"Time\":\"2018-12-18T22:37:00\",\"BME680\":{\"Temperature\":21.3,\"Humidity\":38.1,\"Pressure\":1021.4,\"Gas\":308.19},\"TempUnit\":\"C\"}">>,
{1549,8803,302986}}.
that contains "tele/folin-house-s1/SENSOR". I don't know erlang coding.
Aucun commentaire:
Enregistrer un commentaire