Samsung syncthru problem after 0.93.0

Is that field also English?
image

As you can see for me the web interface stayed in Hungarian, only that field was changed to English and it solved my problem.

For debugging I used the package and the example code. If you want to test I recommend you to get a Python 3.5+, pip install pySyncThru and use the example code from the repo. However there are two mistakes in the example so you might want to use this:

import asyncio
import aiohttp
from pysyncthru import SyncThru

IP_PRINTER = '192.168.0.25'

async def main():
    async with aiohttp.ClientSession() as session:
        printer = SyncThru(IP_PRINTER, session)
        await printer.update()

        # Is printer online?
        print("Printer online?:", printer.is_online())
        # Show the printer status
        print("Printer status:", printer.device_status())
        if printer.is_online():
            # Show details about the printer
            print("Printer model:", printer.model())
        # Print all available details from the printer
        print("All data:\n", printer.raw())

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

If your printer is Unknown the program will still print all data it could get. It will be in JSON. (If you want to format it to human readable I use Notepad++ and JSTool). For me the status1 field was in Hungarian and it caused the problems.

Now is see why my web interface stayed in Hungarian. The attribute you need to change is not the one on the upper right corner but the one here, because this changes the language of the printer not the web interface:

1 Like

I don´t think I have these settings for language and time but everything on the information pages is in English

I have the same problem. Some time ago syncthru started to display ‘Unknown’ and a few updates later the problem still exists. I have set the language to English and it didn’t help.

Are your devices displaying everything in English? Not only on the web interface but on the device itself?

If so than my only advice would be to try testing by hand with the Python code and package. It helps a lot if you see the raw data that the package could get from the printer.

Or you could probably check the info JSON on http://your.printer.ip/sws/app/information/home/home.json. Check what is status1.

My printer has no display, I guess thats why there is not settings for time and language.
I tried the info on JSON and everything seems to be in English.
Here is a Little bit.

toner_black: { opt: 1, remaining: 75, cnt: 570, newError: “” }, toner_cyan: { opt: 0, : { opt: 0, remaining: 0, cnt: 0, newError: “” }, drum_black: { opt: 1, remaining: 86, newError: “” }, drum_cyan: { remaining: 0, cnt: 0, newError: “” }, toner_magenta: { opt: 0, remaining: 0, cnt: 0, newError: “” }, toner_yellowopt: 0,

Please copy the part which containts the status1 field.

status: { hrDeviceStatus: 2, status1: “”, status2: “”, status3: “”, status4: “” }, identity: { model_name: “M262x 282x Series”, host_name: “Samsung_M2825DW”, location: “”, serial_num: “ZD31B8GD4B00GBF”, ip_addr: “192.168.1.111”, ipv6_link_addr : “”, mac_addr

My status1 code is empty.

{ status: { hrDeviceStatus: 2, status1: "", status2: "", status3: "", status4: "" }, identity: { model_name: "M2020 Series", host_name: "SEC30CDA73BF6C6", location: "", serial_num: "ZF47B8GFAC01HDX", ip_addr: "192.168.1.103", ipv6_link_addr : "", mac_addr: "30:CD:A7:3B:F6:C6", admin_email: "", admin_name: "", admin_phone: "", customer_support: "" }, toner_black: { opt: 1, remaining: 89, cnt: 127, newError: "" }, toner_cyan: { opt: 0, remaining: 0, cnt: 0, newError: "" }, toner_magenta: { opt: 0, remaining: 0, cnt: 0, newError: "" }, toner_yellow: { opt: 0, remaining: 0, cnt: 0, newError: "" }, drum_black: { opt: 0, remaining: 0, newError: "" }, drum_cyan: { opt: 0, remaining: 100, newError: "" }, drum_magenta: { opt: 0, remaining: 100, newError: "" }, drum_yellow: { opt: 0, remaining: 100, newError: "" }, tray1: { opt: 1, paper_size1: 4, paper_size2: 0, paper_type1: 2, paper_type2: 0, capa: 150, newError: "" }, tray2: { opt: 0, paper_size1: 0, paper_size2: 0, paper_type1: 2, paper_type2: 0, capa: 0, newError: "" }, tray3: { opt: 0, paper_size1: 0, paper_size2: 0, paper_type1: 2, paper_type2: 0, capa: 0, newError: "" }, tray4: { opt: 0, paper_size1: 0, paper_size2: 0, paper_type1: 2, paper_type2: 0, capa: 0, newError: "" }, tray5: { opt: 0, paper_size1: 0, paper_size2: 0, paper_type1: 0, paper_type2: 0, capa: 0, newError: "0" }, mp: { opt: 0, paper_size1: 0, paper_size2: 0, paper_type1: 2, paper_type2: 0, capa: 0, newError: "" }, manual: { opt: 0, paper_size1: 0, paper_size2: 0, paper_type1: 2, paper_type2: 0, capa: 0, newError: "" },	GXI_INTRAY_MANUALFEEDING_TRAY_SUPPORT: 0, GXI_INSTALL_OPTION_MULTIBIN:0, multibin: [ ["Bin", 100, 0] ], outputTray: [ [1, 100, ""] ], capability: { hdd: {opt: 2, capa: 0}, ram: {opt: 131072, capa: 131072}, scanner: {opt: 0 , capa: 0} }, options: { wlan: 1 }, GXI_ACTIVE_ALERT_TOTAL: 0, GXI_ADMIN_WUI_HAS_DEFAULT_PASS: 1, GXI_SUPPORT_COLOR: 2, GXI_SYS_LUI_SUPPORT: 0, GXI_A3_SUPPORT: 0, GXI_TRAY2_MANDATORY_SUPPORT: 0, GXI_SWS_ADMIN_USE_AAA:0, GXI_TONER_BLACK_VALID: 1, GXI_TONER_CYAN_VALID: 1, GXI_TONER_MAGENTA_VALID: 1, GXI_TONER_YELLOW_VALID: 1, GXI_IMAGING_BLACK_VALID: 1, GXI_IMAGING_CYAN_VALID: 1, GXI_IMAGING_MAGENTA_VALID: 1, GXI_IMAGING_YELLOW_VALID: 1, GXI_SUPPORT_PAPER_SETTING: 0 }

It is really interesting but I am quite sure this is the root of the problem, since the code relies on the status1 information and if it is invalid or null it shows as Unknown.

If you want to keep trying I might suggest to try settings from Easy Printer Manager or try a factory reset. I do not know what caused the problem but it seems like it is not the fault of the code.

Because you do not have status1 your printer status will be Unknown. As a result the is_online(self) function will always return False and that function is used in the Home-Assistant component to check if it can update the sensor fields. A workaround can be made on the code side but it is hard to test and it is more likely to throw different exceptions.

Great ideas Oliver! Seems like the string matching may be off. My printer returns Sleeping… (with four periods, while the code tries to match on three)

{ status: { hrDeviceStatus: 2, status1: "Sleeping....", status2: "", status3: "", status4: "" },

Based on the results of this thread and the fact that this used to work for all of us, I’m thinking that status1 was not previously used to qualify things. And it might be a challenge to be used, looking at the variety of responses.

So I looked into the code and my only guess would be that this part was added to the code

    def is_online(self) -> bool:
        """Return true if printer is online."""
        return (self.device_status() != SyncThru.OFFLINE
                and self.device_status() != 'Unknown')

The self.device_status() != 'Unknown' part was added 7 months ago. Probably the Home-Assistant compontent bumped to this version much later (4 months ago). Before this commit the function only checked if the printer is not offline but from that point on it checks for unknown as well. That means it considers the Unknown status printers as offline (and unknown if it cannot match status1 field with the given data) and none of the sensor componsents work.

You might try to download the component from this state, before the update (https://github.com/home-assistant/home-assistant/tree/2c07bfb9e0ac03fdf74b83152f4511ed7f7104b0/homeassistant/components/syncthru) and load as a custom component (https://developers.home-assistant.io/docs/en/creating_component_index.html).

2 Likes

Alternatively, if someone knows how to use a different pysyncthru/_init.py, try changing line 64 (to preserve all the other changes that were made in that revision).

The dev posted on the PR that someone could try editing the existing HA sensor component in a different way from Oliver’s idea:

Can someone in this thread test whether removing (all) the if self.syncthru.is_online(): lines in the sensor component fixes this issue with his/her respective printer? I currently do not have access to my printer…

Hey guys, especially @KOliver, thanks for the troubleshooting! I am very open to Issue opening/ PRs at the underlying pysyncthru repository. For those with language related issues (and all the others) I created an Issue template, so that you can post your versions of the status1 field (featuring a small how-to on retrieving it, if that is an issue).

Thanks for your help, I hope we can fix this library :slight_smile:

2 Likes

For easy clicking, here’s where everyone can report different status1 messages:

Sign in to GitHub · GitHub

BE SURE to collect up json from ALL the states your printer goes through:

  • Sleeping
  • Ready
  • Warming up

Just strange that some people now has an emty status1 and some real states.

Thank you very much!!

I did exactly what you suggested, load it as custom component and everything works as it used to!

Thanks!

Was there ever a solution to this problem other than loading it as a custom component?
Update: After updating to 0.98.1 it now seems to work again :slight_smile:

After upgrading to 0.104.0 :face_with_head_bandage:

36

:slightly_frowning_face: