Closed jacoscaz closed 6 days ago
I may be misunderstanding, as it's been a while since I've done much to mqttthing (as I migrated my own home to HomeAssistant), but I think each accessory gets its own instance of mqttthing anyway and so global is per-accessory?
If not, what you're suggesting makes a lot of sense and I'm happy to accept a PR.
I may be misunderstanding, as it's been a while since I've done much to mqttthing (as I migrated my own home to HomeAssistant), but I think each accessory gets its own instance of mqttthing anyway and so global is per-accessory?
If not, what you're suggesting makes a lot of sense and I'm happy to accept a PR.
@arachnetech I stand corrected! I I very likely misinterpreted a couple of lines of code - apologies for bothering you. I'll close this one for now and reopen if needed. Thank you for the super-quick feedback!
Hello @arachnetech! First of all, thank you for this wonderful plugin. Brilliant work and it's making my life so much easier in pursuing my idea of a locally-managed smart home. That being said, would you be happy with a PR that extends the
state
parameter provided toapply
functions with astate.accessory
property referencing a state object scoped to the accessory itself?apply
functions are provided with astate
parameter whosestate.global
property refers to a state object that seems to be scoped to the MQTT client / connection. However, I often find myself needing to share state acrossapply
functions of the same accessory; this is something that can already be done by using thestate.global
object with per-accessory property names but that's a bit clunky. It would be better to just dostate.accessory.foo = 'bar'
. I think I have an idea of how to do it but I wanted to check in with you first before committing to it.