[1.3] Telegram Push notifications

Have you done something on your NEMS server to make it more usable for yourself? Want to share your code? I'd love for you to share and may include your ideas in future releases of NEMS.
baggins
Member
Posts: 50
Joined: Tue Oct 03, 2017 4:46 am

RE: Telegram Push notifications

Post by baggins »

I redid the whole thing, but no luck: only email...

I cannot send you a support.nems since there is no nems-support in /usr/local/bin anymore???

I noticed two things after restoring:
1) Even though I could see from the nems-restore output that the SST data were imported, they were not available. I had to re-enter them with the SST tool.
2) The Notification settings were not complete. I had to add the telegram notifications.

PS: I actually did the whole procedure again after I noticed that nems-support was missing...
Last edited by baggins on Thu Nov 29, 2018 3:30 am, edited 1 time in total.
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

The Pi image is ~6 months old, so make sure you run sudo nems-update

That's probably why you're not seeing nems-support. Please confirm and let me know if you're able then to send me a support.nems file.

I'd also be happy to SSH in and have a look if you like.

Robbie
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

Thank you for the new file.

Your issue must be something obscure that I'm not quite seeing... everything looks fine, and the patch I created for your backup.nems file worked as it should have.

I just sent a test notification to your bot... did you receive it? The result was: "ok":true, so I know it went out.

Lemme know.
Robbie
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
baggins
Member
Posts: 50
Joined: Tue Oct 03, 2017 4:46 am

RE: Telegram Push notifications

Post by baggins »

Yes, I did receive the message.
How did you send it?
I know I can send a message when I run the script from the command line. That works on 1.3 also.

Thanks.
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

Ah yes; you'd mentioned that previously. My test was CLI. I'll have to setup a NEMS server this weekend to test with your same settings to see what's going on.

Cheers,
Robbie
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
baggins
Member
Posts: 50
Joined: Tue Oct 03, 2017 4:46 am

RE: Telegram Push notifications

Post by baggins »

I has some spare time and did the following:
  • reflashed SD card
  • nems-init
  • nems-update
  • entered data in SST
  • tested mail and telegram notifications from command line
  • added host that I knew would generate notifications
Both mail and telegram notifications work...
If I have some more spare time I will add all the other hosts step by step and then change SD cards with my 'production' NEMS. I will have to tinker again somewhat to get a fixed IP address since I have no access to the router that is installed by my ISP at home...

There is one issue with the motd.
This is what I get when I ssh in the machine:

Code: Select all

Linux nems 4.14.44-v7+ #1117 SMP Thu May 31 16:57:56 BST 2018 armv7l

Last login: Sun Dec  2 11:49:00 2018
Error: either "dev" is duplicate, or "proto" is a garbage.
    while executing
"exec -- /usr/local/bin/nems-info ip"
    invoked from within
"set nemsip [exec -- /usr/local/bin/nems-info ip]"
    (file "/etc/motd.tcl" line 33)
I also changed the default keyboard layout using raspi-config. This works, but when runnig eg. nems-init and nems-update I get messages such as:

Code: Select all

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_TIME = "nl_BE.UTF-8",
        LC_MONETARY = "nl_BE.UTF-8",
        LC_MEASUREMENT = "nl_BE.UTF-8",
        LC_NUMERIC = "nl_BE.UTF-8",
        LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
Cheers.
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

Glad Telegram is working out of the box for you now. Let me know if you spot anything else or need me to look at it further.

Your issue with MOTD was already patched. It happens when you have both Ethernet and WiFi enabled: nems-info can't figure out which is the IP address. Run sudo nems-update to get the patch.

perl: warning: Setting locale failed. can be ignored. This is a known issue with perl+SSH. When you connect from your computer via SSH it tries to detect the locale of your connecting PC, but cannot. It's only a warning to that effect, not an error.

Cheers,
Robbie
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
baggins
Member
Posts: 50
Joined: Tue Oct 03, 2017 4:46 am

RE: Telegram Push notifications

Post by baggins »

Robbie Ferguson wrote: Glad Telegram is working out of the box for you now. Let me know if you spot anything else or need me to look at it further.

Your issue with MOTD was already patched. It happens when you have both Ethernet and WiFi enabled: nems-info can't figure out which is the IP address. Run sudo nems-update to get the patch.

perl: warning: Setting locale failed. can be ignored. This is a known issue with perl+SSH. When you connect from your computer via SSH it tries to detect the locale of your connecting PC, but cannot. It's only a warning to that effect, not an error.

Cheers,
Robbie
I ran sudo nems-update but the motd error is still there...

I can see in the log that patch 20181201-wifi has been applied.

Running nems-info ip gives as expected: Error: either "dev" is duplicate, or "proto" is a garbage.
I'm using an RPi 3 Model B for this test.
User avatar
Robbie Ferguson
Posting Freak
Posts: 835
Joined: Wed Mar 07, 2012 3:23 pm
Location: Ontario, Canada
Contact:

RE: Telegram Push notifications

Post by Robbie Ferguson »

It sounds to me as though your nems-scripts installation is corrupt.

Please reinstall nems-scripts:

Code: Select all

sudo rm -rf /usr/local/share/nems/nems-scripts && cd /usr/local/share/nems && sudo git clone https://github.com/Cat5TV/nems-scripts
Then try nems-info ip again.

Let me know.

Robbie
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
baggins
Member
Posts: 50
Joined: Tue Oct 03, 2017 4:46 am

RE: Telegram Push notifications

Post by baggins »

Robbie Ferguson wrote: It sounds to me as though your nems-scripts installation is corrupt.

Please reinstall nems-scripts:

Code: Select all

sudo rm -rf /usr/local/share/nems/nems-scripts && cd /usr/local/share/nems && sudo git clone https://github.com/Cat5TV/nems-scripts
Then try nems-info ip again.

Let me know.

Robbie
No luck...

Code: Select all

emm@nems:~ $ sudo rm -rf /usr/local/share/nems/nems-scripts && cd /usr/local/share/nems && sudo git clone https://github.com/Cat5TV/nems-scripts
[sudo] password for emm: 
Cloning into 'nems-scripts'...
remote: Enumerating objects: 124, done.
remote: Counting objects: 100% (124/124), done.
remote: Compressing objects: 100% (92/92), done.
remote: Total 1555 (delta 71), reused 83 (delta 32), pack-reused 1431
Receiving objects: 100% (1555/1555), 328.96 KiB | 630.00 KiB/s, done.
Resolving deltas: 100% (986/986), done.
emm@nems:/usr/local/share/nems $ nems-info ip
Error: either "dev" is duplicate, or "proto" is a garbage.
This doesn't bother me actually as it only shows up during ssh...
Locked