cmroche / OctoPrint-HomeAssistant

Home Assistant plugin for OctoPrint, enabling MQTT discovery of you device and sensors
110 stars 18 forks source link

[Bug] pause switch does not resume print #96

Closed manolitto closed 1 year ago

manolitto commented 2 years ago

Expected behaviour

Switching pause switch to off should actually resume the print in OctoPrint.

Observed behaviour

Switching pause switch to off has no effect.

What I found out

When the printer is in pause mode and when switching the pause switch in HA to off a MQTT message with payload "False" is sent to topic "octoPrint/hassControl/pause" which seems ok. However, it does NOT actually resume the print on OctoPrint side.

What DID work is sending an empty message to "octoPrint/hassControl/pause" - it successfully resumed my print.

cmroche commented 2 years ago

Thanks for the report, I'll take a look soon.

nquick commented 1 year ago

Hi,

Did you find a way of resolving this? I'm building a WiFi filament sensor and can get it to pause, but not resume.

Thanks

AlekEagle commented 1 year ago

Hey, I made a PR fixing it, depending on the switch position, Lovelace will send True or False for the MQTT message/payload. If the switch is currently set to off and the user interacts with it, Lovelace will emit True via MQTT, and vice versa for the switch in the on position. Also, for button entities, Lovelace sends PRESS as the payload. What I did in #100 was check if the message is PRESS for the buttons. I have tested this and it does work with the latest Home Assistant and OctoPrint.