[<<][thermostat][>>][..]
Sun Feb 4 11:54:04 EST 2018

CData

               %% zoo   lroom  zoe   beaglebone  garage broom  groom
    Meas = [{62, [65.6, 63.8,  66.3, 65.9,       68.7,  65.0,  69.2]},
            {59, [63.6, 62.0,  64.1, 62.2,       66.3,  62.9,  67.6]},
            {56, [60.1, 58.7,  61.2, 60.6,       62.8,  58.5]},
            {56, [59.8, 58.0,  60.8, 60.1,       62.7,  58.1]}],

    FCal =
        lists:foldl(
          fun({Ref, Temps}, M0) ->
                  lists:foldl(
                    fun({Host, Temp}, M1) ->
                            List = maps:get(Host, M1, []),
                            maps:put(Host, [{Ref,Temp} | List], M1)
                    end,
                    M0,
                    zip2(Hosts,Temps))
          end,
          #{},
          Meas),

#{garage => [{56,62.7},{56,62.8},{59,66.3},{62,68.7}],
  broom => [{56,58.1},{56,58.5},{59,62.9},{62,65.0}],
  beaglebone => [{56,60.1},{56,60.6},{59,62.2},{62,65.9}],
  groom => [{59,67.6},{62,69.2}],
  lroom => [{56,58.0},{56,58.7},{59,62.0},{62,63.8}],
  zoe => [{56,60.8},{56,61.2},{59,64.1},{62,66.3}],
  zoo => [{56,59.8},{56,60.1},{59,63.6},{62,65.6}]}


              
      
zip2([],_) -> [];
zip2(_,[]) -> [];
zip2([A|As],[B|Bs]) -> [{A,B}|zip2(As,Bs)].
    
%% Edit: I've renamed devices afterward so there might be errors




[Reply][About]
[<<][thermostat][>>][..]