MultiChannelCommandEncapsulation report for :switch_binary_get
jasonmj opened this issue · comments
With a multi-channel switch, it is possible to set switch binary values for specific endpoints with:
Grizzly.send_command(10, :multi_channel_command_encapsulation,
destination_end_point: 2,
command_class: :switch_binary,
command: :switch_binary_set,
parameters: [target_value: :on, duration: 0]
)
However, attempts to retrieve the current value with :switch_binary_get
do not provide any indication of that value in command report:
iex(app@hellohome.local)34> Grizzly.send_command(10, :multi_channel_command_encapsulation,
...(app@hellohome.local)34> destination_end_point: 2,
...(app@hellohome.local)34> command_class: :switch_binary,
...(app@hellohome.local)34> command: :switch_binary_get,
...(app@hellohome.local)34> parameters: []
...(app@hellohome.local)34> )
{:ok,
%Grizzly.Report{
command: nil,
command_ref: #Reference<0.4143522728.269221889.20551>,
node_id: 10,
queued: false,
queued_delay: 0,
status: :complete,
transmission_stats: [],
type: :ack_response
}}
When using SwitchBinary.get/1
to retrieve the current value of the switch, it is only possible to get the on/off status of all switching in the multi-level switch (either all are off or at least one is on).
I have a few multi-channel switches that I would like to use with Grizzly, but I'm struggling with this issue. Any insights would be much appreciated.
Aha! After a little digging into the code, I found :multi_channel_get_command_encapsulation
, which is very similar to :multi_channel_command_encapsulation
except instead of using the AckResponse
handler, it uses WaitReport
. This solved my problem.