Windows PC remote control (Shutdown, …)

  • Platform information:

    • Hardware: Raspberry Pi
    • OS:Openhabian
    • openHAB version: OpenHab 2.4
  • Issue of the topic: please be detailed explaining your issue
    I was reading this:-

    Windows PC remote control (Shutdown, ...)

and did this:-
debian release wheezy

cd /etc/apt/sources.list.d/
sudo wget http://repo.mosquitto.org/debian/mosquitto-wheezy.list

It didn’t work I keep going with the rest of the setup.
I don’t know if doing with password will upset my openhab

sudo mosquitto_passwd -c /etc/mosquitto/passwd USER_NAME

3:1 After edit moquitto configuration file ““sudo vim /etc/mosquitto/mosquitto.conf”” what I end up could not us can not add the line it ask me too.

I coming up with

e325 AttentionFound a swap file by the name ".mosquitto.conf.swp"
          owned by: root   dated: Fri Nov  2 14:57:07 2018
         file name: /etc/mosquitto/mosquitto.conf
          modified: no
         user name: root   host name: openHABianPi
        process ID: 1088 (still running)
While opening file "mosquitto.conf"
             dated: Fri Nov  2 14:42:22 2018

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r mosquitto.conf"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".mosquitto.conf.swp"
    to avoid this message.

Swap file ".mosquitto.conf.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:

I have stoped there

Thanks Aaron Twomey

yup, that link gives a 404.
you shouldn’t need to do this step. the regular repos include the mosquitto broker.
just do sudo apt-get update && sudo apt-get install mosquitto and it will install the MQTT broker

try (R) first and if it doesn’t work, remove .mosquitto.conf.swp and try to edit the file again.

[16:57:26] openhabian@openHABianPi:/etc/mosquitto$ sudo apt-get update && sudo apt-get
[sudo] password for openhabian:
Hit:2 http://archive.raspberrypi.org/debian stretch InRelease
Ign:3 http://repos.azulsystems.com/debian stable InRelease
Hit:4 http://repos.azulsystems.com/debian stable Release
Hit:5 https://deb.nodesource.com/node_8.x stretch InRelease
Hit:6 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Hit:8 https://repo.mosquitto.org/debian jessie InRelease
Ign:1 https://openhab.jfrog.io/openhab/openhab-linuxpkg unstable InRelease
Hit:9 https://openhab.jfrog.io/openhab/openhab-linuxpkg unstable Release
Reading package lists... Done
N: Ignoring file 'mosquitto-jessie.list.1' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
N: Ignoring file 'mosquitto-jessie.list.2' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
apt 1.4.8 (armhf)
Usage: apt-get [options] command
       apt-get [options] install|remove pkg1 [pkg2 ...]
       apt-get [options] source pkg1 [pkg2 ...]

apt-get is a command line interface for retrieval of packages
and information about them from authenticated sources and
for installation, upgrade and removal of packages together
with their dependencies.

Most used commands:
  update - Retrieve new lists of packages
  upgrade - Perform an upgrade
  install - Install new packages (pkg is libc6 not libc6.deb)
  remove - Remove packages
  purge - Remove packages and config files
  autoremove - Remove automatically all unused packages
  dist-upgrade - Distribution upgrade, see apt-get(8)
  dselect-upgrade - Follow dselect selections
  build-dep - Configure build-dependencies for source packages
  clean - Erase downloaded archive files
  autoclean - Erase old downloaded archive files
  check - Verify that there are no broken dependencies
  source - Download source archives
  download - Download the binary package into the current directory
  changelog - Download and display the changelog for the given package

See apt-get(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
                                        This APT has Super Cow Powers.

======================================================================
Ok so were do I start to do the rest of Win PC Remoto control.

sudo rm /etc/apt/sources.list.d/mosquitto-jessie.list*
sudo apt-get update && sudo apt-get install mosquitto

Ps: How to use code fences
Ps2: MQTT Binding (v1.11) Getting Started 101

[17:17:25] openhabian@openHABianPi:~$ sudo apt-get update && sudo apt-get install mosquitto

Hit:2 https://deb.nodesource.com/node_8.x stretch InRelease
Hit:3 http://archive.raspberrypi.org/debian stretch InRelease
Ign:4 http://repos.azulsystems.com/debian stable InRelease
Hit:5 http://repos.azulsystems.com/debian stable Release
Hit:6 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Ign:1 https://openhab.jfrog.io/openhab/openhab-linuxpkg unstable InRelease
Hit:8 https://openhab.jfrog.io/openhab/openhab-linuxpkg unstable Release
Reading package lists... Done
N: Ignoring file 'mosquitto-jessie.list.1' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
N: Ignoring file 'mosquitto-jessie.list.2' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
Reading package lists... Done
Building dependency tree
Reading state information... Done
mosquitto is already the newest version (1.4.10-3+deb9u2).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
N: Ignoring file 'mosquitto-jessie.list.1' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
N: Ignoring file 'mosquitto-jessie.list.2' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension

looking better thank you, do I need to remove mosquitto-jessie.list.1 & mosquitto-jessie.list.2?

the Broker is already installed
Are you already using it for MQTT comms?

you can leave them there but they are useless (and being ignored from apt)
they are wrong anyway since you are on Raspbian Stretch (Debian 9)
Jessie = Debian 8
I would remove these 2 files

Ps: @rhapen needs to improve his tutorial blog entry :slight_smile:

I use MQTT all ready but did this setup so I try doing his way as tho it may up date a newer one or tell me I got the latest one.

I can’t remove…

[17:36:14] openhabian@openHABianPi:/etc/apt/sources.list.d$ rm mosquitto-jessie.list.1
rm: remove write-protected regular file 'mosquitto-jessie.list.1'? y
rm: cannot remove 'mosquitto-jessie.list.1': Permission denied

I was going to update the posted once I have everything working.

you are trying to remove them as user openhabian
either use sudo rm ... or switch to root with sudo su and then try again

careful with the changes from the blog since he recommends adding authentication for the connections to the Broker. make sure that you update correctly your binding config also (and other MQTT endpoints)

Should I remove ""mosquitto-repo.gpg.key.1 “” too

[18:01:36] root@openHABianPi:/home/openhabian# ls
mosquitto-repo.gpg.key  mosquitto-repo.gpg.key.1  README.txt

Yep going in to root worked how do I get back?

[18:03:19] root@openHABianPi:/etc/apt/sources.list.d# rm mosquitto-jessie.list.1[18:03:26] root@openHABianPi:/etc/apt/sources.list.d# ls
mosquitto-jessie.list.2  openhab2.list  zulu-embedded.list
nodesource.list          raspi.list
[18:03:30] root@openHABianPi:/etc/apt/sources.list.d# rm mosquitto-jessie.list.2[18:03:43] root@openHABianPi:/etc/apt/sources.list.d# ls
nodesource.list  openhab2.list  raspi.list  zulu-embedded.list

I thinking I need wait and look for a easier to read tutorial

Did I adding authentication for the connections to the Broker at the start.

yes :slight_smile:

exit

Hi, added in the tuttorial how to get proper version:
cat /etc/*release*
and correct link for stretch version:
http://repo.mosquitto.org/debian/mosquitto-stretch.list

1 Like

Thanks did I adding authentication for the connections to the Broker when.

sudo mosquitto_passwd -c /etc/mosquitto

but why would you go to the mosquitto repo?
both Debian 8 & 9 include in the “default” repos the mosquitto package
just instruct users to deploy the standard mosquitto package (it will simplify your tutorial also)

because in older version the packages got old. and it most likely will happen with the newer versions as well

by the way, i would make it more clear for not very experienced users to follow the proper step in the selection of the release

take a look at how these guys structure the info as an example: https://www.tecmint.com/install-openssh-server-in-linux/

The install instructions: for Mosquitto are a bit confusing as they are now.

Good tutorial by the way, I like the WinThing section

thanks for constructive points. just updated it

1 Like

@rhapen
use the output destination of wget to make sure that users deploy the list file in the /etc/apt/sources.list.d/ (you do tell them to cd into that… but making sure :))

also, you can put in 1 line the key addition

see: https://repo.mosquitto.org/debian/readme.txt (they sent it to /etc/apt/sources/list.d/ instead of the /etc/apt/sources.list.d/)

@Dim I think I add authentication how do I take that off.

@rhapen if I can skip using authentication can you help with the rest of the setup

auth is enabled or disabled in your /etc/mosquitto/mosquitto.conf file

the mosquitto_passwd command just creates a file with users and passwords to be used by the auth mechanism of the Mosquitto Broker.

You can use Mosquitto without auth if you want

I better have a better read over this tonight, So I know what I want.

1 Like