[Custom component] AsusRouter integration

Hi, just trying HA 2022.12.0.b0 and it’s giving an error, in case this is useful for you.

Logger: homeassistant.util.package
Source: util/package.py:98
First occurred: 7:47:28 PM (3 occurrences)
Last logged: 7:47:36 PM

Unable to install package asusrouter==0.12.0: ERROR: Cannot install asusrouter==0.12.0 because these package versions have conflicting dependencies. ERROR: ResolutionImpossible: for help visit Dependency Resolution - pip documentation v23.0.dev0 [notice] A new release of pip available: 22.3 → 22.3.1 [notice] To update, run: pip install --upgrade pip

@SpicyLimes,

Oh, I have lost the time zone, as I see now.

Then, unfortunately, it becomes more complicated

Code #1
var utc = new Date(x.connected);
var diff = (new Date()).getTimezoneOffset() / 60;
var date = new Date(utc.setHours(utc.getHours() - diff)).toJSON()
var dateRegex = /^([\d-]{10})T.*$/
var dateData = dateRegex.exec(date);
var timeRegex = /^.*T([\d:]{8}).*$/
var timeData = timeRegex.exec(date);
dateData[1]+" "+timeData[1]
Code #2
var utc = new Date(x.connected);
var diff = (new Date()).getTimezoneOffset() / 60;
var date = new Date(utc.setHours(utc.getHours() - diff)).toJSON()
var dateRegex = /^(\d{4})-(\d{2})-(\d{2})T.*$/
var dateData = dateRegex.exec(date);
var timeRegex = /^.*T(\d{2}):(\d{2}):(\d{2}).*$/
var timeData = timeRegex.exec(date);
dateData[1]+"-"+dateData[2]+"-"+dateData[3]+" "+
  timeData[1]+":"+timeData[2]+":"+timeData[3]

For am/pm time, I think, you should be able to use this code. But even more steps are needed.

Code #3
var utc = new Date(x.connected);
var diff = (new Date()).getTimezoneOffset() / 60;
var date = new Date(utc.setHours(utc.getHours() - diff)).toJSON()
var dateRegex = /^(\d{4})-(\d{2})-(\d{2})T.*$/
var dateData = dateRegex.exec(date);
var timeRegex = /^.*T(\d{2}):(\d{2}):(\d{2}).*$/
var timeData = timeRegex.exec(date);
var ampm = (Math.floor(timeData[1]/12)) ? "pm" : "am";
var hours = timeData[1] % 12 > 0 ? timeData[1] % 12 : 12
dateData[1]+"-"+dateData[2]+"-"+dateData[3]+" "+
  hours+":"+timeData[2]+":"+timeData[3]+" "+ampm

@spry-salt,

Thanks for your report! I will check it out

1 Like

Hey, people,

Some of you have already noticed, that from 2022-12, HA will mark Python 3.9 as deprecated and to be removed completely in 2023-2. The question is, whether AsusRouter should still support Python 3.9 up till HA 2023-2 release or should we drop it already now and optimize some code for both integration and the backend library?

First let me say ‘thank you’ for the integration and the work you put in on it.

For those systems running HAOS, Python should already be 3.10. I’m fine with dropping 3.9 support, but we will need to hear from others.

I’m running HAOS, so either way is fine with me.

:loudspeaker: Version 0.13.1 of AsusRouter is already available in HACS. Please, check it out - it should work with HA 2022-12 without any problems with dependencies.

1 Like

This is absolutely perfect - thank you!

Perfect, many thanks.

:cactus: AsusWRT 388.x

Probably you have already noticed, that lots of 802.11ax routers started receiving updates to the latest 388.x firmware, with some new features and some changes to the old ones. :bomb:

For me and AsusRouter as well, the plan is to fully support these builds. And the first new feature, coming to the integration from branch 388 will be the support of WireGuard :airplane:

:boom: Merlin

Since Merlin 388.1 is already out of beta, I am glad to announce, that AsusRouter will fully support it! :tada:

The only minor problem is for temperature sensors for WiFi modules, which are unavailable because of one more change in the routers’ API endpoint. This will be fixed in the next release (but the fix itself is ready now). :thermometer:

:hammer: Native

The native 388 builds of AsusWRT are already supported as much as possible. :wrench:

The only problem you will experience for now - OpenVPN clients and servers are broken. This is connected to a completely new way of working with VPN released in 388. :open_book: The fix is already planned.

:spiral_calendar: Calendar

  • Fix for OpenVPN on native builds

    I will try to implement the new VPN features as soon as it is possible. But you know, Decembers are a bit of a busy time, so let’s say closer to the end of January. :calendar:

  • WireGuard support

    I don’t have any experience with WireGuard, so understanding and implementing the new feature will require some time. But since the feature is fully supported by my testing device, the currently expected timeframe is January-February

  • No-spoiler alert

    Some new cool features are also expected in AsusRouter at the beginning of the year. I am quite sure, you guys will like it. :boom:


Achivements

A bit about what AsusRouter has already achieved:

  • :mag: We have at least 579 active installations of AsusRouter among users sharing their usage data with HA Analytics. On October 29, we had 528 installations. Looks like we are progressing and AsusRouter is actually useful.
  • :spider_web: In the last 26 days (since the AsusRouter documentation page was published) at least 284 users have visited it. You know, this one: documentation
  • :desktop_computer: AsusRouter supports at least 32 different models of routers.

As usual, please don’t be afraid to suggest new features and report bugs. All the reports are welcome and if possible all of the issues are solved. You can fill in a report in AsusRouter GitHub or here.

There is always a way to make AsusRouter even better. Let’s do it.


:coffee:

You can always support the development of AsusRouter using the BuyMeACoffee service:


:christmas_tree:

Have a nice holiday time!

1 Like

:christmas_tree: Holidays are coming

and with holidays, guests are relatives are coming for visits to our places. Connecting to our WiFi and…

… adding tons of device_trackers to HA which we will never actually use.

Happened to you? I can easily relate. And now the new version of AsusRouter is here to help you with the HA mess.

0.14.0 :christmas_tree: Holidays-ready release

:mag_right: New asusrouter.remove_trackers service

Probably, you have noticed, that you cannot just easily remove entities, even if the device did not appear online for a long time. This is done by purpose - device trackers are watched all the time (so HA will notice when it appears online again).

With the new service, you can mark unwanted entities as non-watched. This will allow you to remove the entities.

Please, keep in mind:

  • only offline device_trackers will be actually marked as non-watched
  • if you reboot HA before removing the entities, they will become watched again

Detailed description.

:thermometer: Temperature support for Merlin 388

Now, that Merlin 388.1 is officially released as stable, AsusRouter is adding support for the new way of reporting WiFi module temperatures.


Release

Already available in HACS


:book: Might be interesting

If you are interested in what else is planned for AsusRouter, please refer to this post.

:exclamation: Deprecation remainder

Please, don’t forget about the active deprecation warning for some parameters (entity_id, mac and name) of asusrouter.device_internet_access service. More details were here. They will be removed in version 0.15.0 and should not be used anymore.

:books: Help me improve the documentation

Your suggestions on how to improve AsusRouter documentation are always welcome.

Found an error or something missing? Let me know - so I can fix it.


:gift: :christmas_tree:

2 Likes

Is the service asusrouter.remove_trackers only for entities created with devices, or would we be able to remove entities that show the MAC addresses? I tried using the service on entities without an associated device, but am still not able to remove it after. Maybe I’m doing something wrong?

Thanks again for your awesome work and continued development of this awesome integration!

Hey,

You should be able to remove any device_tracker entity, which is not reported by your router anymore (regardless of whether a device is created in HA).

It might be, your router is still reporting the device (if it was connected recently enough and your router didn’t clean up yet). In this case, it should be possible after the router reboot.

Should be like on the sequence of the snapshots

Snapshots



Please, check whether the device reboot helps. Or whether it works with some other device_tracker

:open_book: 0.14.1

Thanks to Nyaran, AsusRouter once again has a complete Spanish translation.


AsusRouter translations

Currently, AsusRouter has full support for the following languages:

  • :uk: English
  • :ukraine: Ukrainian
  • :es: Spanish

and partial support for:

  • :brazil: Portuguese (Brazil)

Add your language to AsusRouter

Are you fluent (or just good) in some languages? Help me translate AsusRouter.

Even if you don’t know how to create a Pull Request to the AsusRouter repo, just create a new issue or let me know in any way you prefer - I will help you to prepare all the needed.


:boom:

1 Like

May I create a PR directly at the main branch?

:+1: Yes. It’s completely fine to create PR to the main branch. In case something will be wrong, I will help you with edits before merging it


By the way, we already got the French translation :bomb:

1 Like

Hi, I can do Portuguese (Portugal) translation.
Just tell me how

I am preparing a translation into cs (Czech Republic).
One item is not entirely clear to me and that is interval_light. Is it a light data update or something else?

@pepe59,

Yes, this string is for the time interval for the LED binary_sensor / switch update. But since it is supposed to be also used for Aura RGB (when implemented), it’s called a general ‘light’ data.


@Kfixe,

Hey. You would need to:

  • create a fork of the AsusRouter in your GitHub account. Just open the link to the repo and click the Fork button on the top right (on desktop)
  • Open your fork of the repo
  • Go to the custom_components/asusrouter/translations/ path and create a new file named pt.json - that would be a file for Portuguese.
  • Copy the content of en.json there - that is the English translation with all the needed fields
  • Each line presents a key: value pair. You need to translate only values (on the right from the :, on the snapshot values are marked in blue)
  • When all the values are translated and you saved the file, you will be able to create a Pull Request to the AsusRouter repository

Keep in mind, there are many strings repeating twice :slightly_smiling_face:

Snapshot

image

P.S. If you don’t feel confident enough with creating PR or using GitHub, you can just copy the content of the English translation ( ha-asusrouter/en.json at main · Vaskivskyi/ha-asusrouter (github.com)), translate all the values and save the new file on your PC (or other device) and send it to me via email: [email protected]. I will add it to the integration.

I added a translation of cs.json (Czech) to the main branch (merge request).
I hope I didn’t do something wrong.

@pepe59,

Thanks a lot! It’s great! :+1:


0.14.2 :open_book: New languages

Thanks to @pepe59 and novisys, AsusRouter got translated to :czech_republic: Czech and :fr: French! :bomb:

Which totals in 5 fully-supported languages:

  • :czech_republic: Czech
  • :uk: English
  • :fr: French
  • :es: Spanish
  • :ukraine: Ukrainian

and partial support for:

  • :brazil: Portuguese (Brazil)

I think we are doing great! :boom:


:loudspeaker: Everyone is welcome to submit a new language support for AsusRouter