MacWyznawca / homebridge-mqtt-switch-tasmota

Plugin to HomeBridge optimized to work with firmware Sonoff-Tasmota, MQTT.
MIT License
57 stars 18 forks source link

PulseTime #32

Open mscreations opened 6 years ago

mscreations commented 6 years ago

Hello, I've been having an issue with my Sonoff Basic flashed with Tasmota and using this plugin for homebridge. I want to use the PulseTime feature of Tasmota, however there is an issue with the telemetry messaging. As far as I have been able to determine, after this plugin receives a telemetry message, the plugin is then commanding the sonoff to power on. This action causes the Tasmota firmware to reset the pulsetime counter. In my case, the configuration for the plugin sets TelePeriod to 60 seconds. I tried setting PulseTime to 5 minutes (value of 400). The relay never ends up shutting off because the counter resets before ever having a chance to expire.

So a couple of questions arise. How necessary is TelePeriod for this plugin to function? Can I simply set the period to something higher than where I intend to set PulseTime? Even better, is there a way to get the plugin to stop resending the power on message when it is already on?

kodibrain commented 6 years ago

I have the same issue..!

mscreations commented 6 years ago

Check out this fork. It had some issues which I helped fix, but it seems to work much better.

kodibrain commented 6 years ago

Thx! And pulsetime now works?

mscreations commented 6 years ago

With the forked version of the plugin, it works okay. With this version, it sends an extraneous power on command everytime it gets a telemetry update.

i3laze commented 6 years ago

I've got pulsetime 5 (0.5 sec, switchmode 0, switchTopic 0) and for me it currently works just fine (on master branch): I click the switch - it stays on for 2-5 sec then updates status back to off.

No parameters on plugin side. Of course 0.5 is less than my telemetry window (60). Maybe you've got PowerRetain mistakenly enabled on Sonoff-Tasmota? This way device will overwrite it's status with one stored in Broker.

@mscreations, replacing index.js and package.json from your fork didn't ignite for me: There's no Issues tab on your fork page, so I'll post the error here.

[2018-7-22 10:33:32] [Pump] Initializing mqtt-switch-tasmota accessory...

C:\ProgramData\npm\node_modules\homebridge-mqtt-switch-tasmota\index.js:51
      .getCharacteristic(Characteristic.On)
       ^
TypeError: this.service.getCharacteristic is not a function
    at new MqttSwitchTasmotaAccessory (C:\ProgramData\npm\node_modules\homebridg
e-mqtt-switch-tasmota\index.js:51:8)
    at Server._loadAccessories (C:\ProgramData\npm\node_modules\homebridge\lib\s
erver.js:296:29)
    at Server.run (C:\ProgramData\npm\node_modules\homebridge\lib\server.js:86:3
8)
    at module.exports (C:\ProgramData\npm\node_modules\homebridge\lib\cli.js:43:
10)
    at Object.<anonymous> (C:\ProgramData\npm\node_modules\homebridge\bin\homebr
idge:17:22)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
bongibong commented 4 years ago

Hi, I just got this exact issue when configuring a long pulseTime period (30min - 1900). I also noticed that the telemetry messages every 60sec by default, is causing the plugin to resend the command with the status it received. Why when the switch report its state (on / off) we need to send him the command to be in this state again?? that causes the pulseTime counter to reset to the initial value (1900 in my case) and thus, will never expired.. Masking line 135 in the code has solved this issue.. @MacWyznawca, am I missing something by doing that??