iobroker-community-adapters / ioBroker.samsung

Samsung Remote Adapter for ioBroker
MIT License
9 stars 9 forks source link

Adapter not connected on TV turned on #164

Open marian-t-web-de opened 6 months ago

marian-t-web-de commented 6 months ago

Describe the bug
The samsung-community adapter is running, TV is off. After switching TV on, the adapter is still disconnected, using of commands/changung SP's state results for the first in no any action. After some commands the adapter trays to connect and fails, by second try is usually succesfull (see iob log below)

To Reproduce
Steps to reproduce the behavior:

  1. Check samsung-community adapter is running
  2. Switch TV on
  3. After TV is connected to network check iob-log for connection of samsung-community adapter to TV(-IP) - no entries in log
  4. Use some samsung-community commands (via SP state changing, for instance power.checkOn)
  5. check iob-log for connection error...

Expected behavior

  1. The samsung-community adapter is running and checks periodically the connectivity to TV-IP. If connectivity given, adapter connects to TV itself
  2. If 1. is too complicated to release, in the Adapter Statepoints is an SP 'connect' (button) to be implemented, which initiates the connection of Adapter to TV-IP. In this way the TV connectivity can be external checked by ping-Adapter and the connection of Adapter to TV-IP established.

Screenshots & Logfiles
TV ist turned on 19:00, first command (KEY_SLEEP) 22:36, adapter up to this time not connected: 2024-02-28 22:36:00.492 - info: javascript.0 (5101) script.js.common.TV_control_JS: Step=0 Set state samsung-community.0.command val KEY_SLEEP and wait 200ms 2024-02-28 22:36:00.692 - info: javascript.0 (5101) script.js.common.TV_control_JS: Step=1 Set state samsung-community.0.command val KEY_DOWN and wait 200ms 2024-02-28 22:36:00.750 - error: samsung-community.0 (2155) uncaught exception: Connection not yet ready 2024-02-28 22:36:00.760 - error: samsung-community.0 (2155) Error: Connection not yet ready at SamsungTv._assertConnected (/opt/iobroker/node_modules/iobroker.samsung-community/lib/H-and-J-Series-lib/SamsungTv.js:117:13) at SamsungTv.sendKey (/opt/iobroker/node_modules/iobroker.samsung-community/lib/H-and-J-Series-lib/SamsungTv.js:93:10) at Object.send (/opt/iobroker/node_modules/iobroker.samsung-community/main.js:323:87) at send (/opt/iobroker/node_modules/iobroker.samsung-community/main.js:184:12) at Object.stateChange (/opt/iobroker/node_modules/iobroker.samsung-community/main.js:138:21) at Immediate.<anonymous> (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/build/lib/adapter/adapter.js:8502:62) at process.processImmediate (node:internal/timers:476:21) 2024-02-28 22:36:00.761 - error: samsung-community.0 (2155) Connection not yet ready 2024-02-28 22:36:00.769 - info: samsung-community.0 (2155) terminating 2024-02-28 22:36:00.770 - warn: samsung-community.0 (2155) Terminated (UNCAUGHT_EXCEPTION): Without reason 2024-02-28 22:36:00.893 - info: javascript.0 (5101) script.js.common.TV_control_JS: Step=2 Set state samsung-community.0.command val KEY_ENTER and wait 0ms 2024-02-28 22:36:01.274 - info: samsung-community.0 (2155) terminating 2024-02-28 22:36:01.519 - error: host.iobroker Caught by controller[0]: Connection is established but not yet ready 2024-02-28 22:36:01.520 - error: host.iobroker instance system.adapter.samsung-community.0 terminated with code 6 (UNCAUGHT_EXCEPTION) 2024-02-28 22:36:01.520 - info: host.iobroker Restart adapter system.adapter.samsung-community.0 because enabled 2024-02-28 22:36:01.579 - info: javascript.0 (5101) script.js.common.TV_control_JS: checkTVstate, TV/ping: on/true 2024-02-28 22:36:31.543 - info: host.iobroker instance system.adapter.samsung-community.0 started with pid 31565 2024-02-28 22:36:34.536 - info: samsung-community.0 (31565) starting. Version 0.5.0 (non-npm: iobroker-community-adapters/ioBroker.samsung-community#f979771177c9aef7da7d0689d40d92d05d35d291) in /opt/iobroker/node_modules/iobroker.samsung-community, node: v18.19.0, js-controller: 5.0.16 2024-02-28 22:36:34.583 - info: javascript.0 (5101) script.js.common.TV_control_JS: checkTVstate, TV: on (unchanged) 2024-02-28 22:36:34.646 - info: samsung-community.0 (31565) Connection to TV initialised 2024-02-28 22:37:01.471 - info: samsung-community.0 (31565) Successfully connected to your Samsung HJ TV 2024-02-28 22:37:01.597 - info: javascript.0 (5101) script.js.common.TV_control_JS: checkTVstate, TV: on (unchanged)

Versions:
TV is SAMSUNG UE55JS8590TXZG modell 2015 (Tizen) Adapter samsung-community version: 0.5.0

Plattform: docker (official image - v9.0.1) (on second iob installation on RPi3 without docker the same issue) Betriebssystem: linux Architektur: arm CPUs: 4 Geschwindigkeit: 1800 MHz Modell: ARMv7 Processor rev 3 (v7l) RAM: 3.7 GB System-Betriebszeit: 48 T. 16:39:56 Node.js: v18.19.0 time: 1709193161649 timeOffset: -60 NPM: 10.2.3 Adapter-Anzahl: 534 Datenträgergröße: 27.9 GB Freier Festplattenspeicher: 8.4 GB Aktive Instanzen: 24 Pfad: /opt/iobroker/ Betriebszeit: 6 T. 15:09:40 aktiv:

Additional context
Add any other context about the problem here. Moreover the states of Power.checkOnOff and Power.off show different states of TV. TV is Off, checkOn pressed, checkOnOff is off (correct) off is false (not correct):

image
marian-t-web-de commented 5 months ago

As futher developpment I propose to provide an additional StatePoint, which is from adapter to be set (to true) after the adapter instance is connected to the TV - just when the log entry "Successfully connected to your Samsung ** TV " will be send. In this way inside iobroker could be recognizable, if the connection is established. If not and TV is per ping connected, the adapter can (automatically/per script) per restart be connected to TV once more. Further could be an StatePoint "reconnect" to be provided to do it.