jalmeroth / homie-python

A Python-implementation of the homie v2 convention.
https://github.com/marvinroger/homie
54 stars 15 forks source link

Exiting should publish a retained $online false #9

Closed jpmens closed 8 years ago

jpmens commented 8 years ago

Be it with or without Homie.quit(), I think homie-python should publish a retained $offline false when it exits to indicate that the "device" actually is offline, irrespective of whether it crashed (i.e. in which case LWT would fire).

What do you think?

jalmeroth commented 8 years ago

Done.

jalmeroth commented 8 years ago

Whoops, I overlooked what you actually asked for. I made homie.quit() sending an $online = false. Why would we need a distinction of offline states? Wouldn't one need to take action anyway?

jpmens commented 8 years ago

I did not mean distinction; I simply meant if the Python program stops, it (so the "device") is by definition offline, isn't it? So whether the program is killed and the broker sends the LWT or the program is terminated cleanly, the result is "$offline false".

jpmens commented 8 years ago

Sorry: $online false

jpmens commented 8 years ago

To cut a long story short, your commit does exactly what I think it should do.