RemoteMe has a mechanism that allows users (guests) with the appropriate link to control your devices through the website. The key thus generated allows for

  • Specify the time for which a given guest can control the page (in one person mode at a time)
  • The number of credit where, after a specific action, the number of credit decreases
  • Choosing which devices will not be controlled by the specified link
  • Determining whether control can be done by one person at a time or many
  • Time, credit can be increased by using coupons
    • coupon can be one-time (used only once)
    • multiple guests (sessions) can use oneĀ  coupon any number of times

 

Generating guest web page

This site will used by the guest to interact with your devices. On this page you can also display data – similar to the page for control in normal mode.

You can add components just like you do when building a normal page. Additionally, you can indicate how many credits are needed to make the component active:

When the guest credit is below the filled value , the button will be inactive. (Since the button’s inactivity is set on the user’s browser side, it is recommended to check the credit value also on the device side. (For WebRTC communication, points sent from the browser may be falsified by a smart hacker – to counteract this on the Python device side, it’s best to create a variable that will store points value for the active session.))

Of course, you can build more complicated components then, to have the current time and credits on the browser side of the script you need to set listeners that will be called with the current value of credits and time

Turn on guest mode

To allow users to control the website, a key is needed (this is the link that guest will use to control the webPage)

  1. Global Settings
    • Can more than one guest control one page at the same time?
  2. Generate a coupon to increase credit, time and priority in the queue
  3. Adding a new key
  4. Generated key
  5. Turning off the key
  6. Key Properties
    • Name
    • credit at the beginningTime to start
    • Identifier (useful for using on the device side)
  7. Link to the page

To generate a key, we need an existing page, then click the add new key button (3):

  1. Key name (doesn’t matter – just information for us)
  2. The credit users will get at the beginning (and after renewing the session)
  3. Time in seconds (active when one person can use at a time)
  4. Ignored devices – a new state will not be sent to these devices e.g. after a variable change (but when the device is reset and the variable was persistence the variable state will be downloaded)
  5. If checked, the user will be denied access after credit has been used up
    If the webRTC connection could not be established within 15s, the guest will be interrupted (useful when allowing users to view the RPi camera)
  6. Key identifier that is transmitted to devices (documentation link)
  7. Whether the key should be active

After generating the key, we can click on the link icon ((7) on the previous screen) and give it to people who we want to give access to.

Additional files

After generating the first key, new files will be created in our website:

  • welcome.html – this is the file displayed to guests before access
  • finish.html – file displayed to guests after losing access (when time has run out or credit has run out (when the setting is correct))
  • error.html – when there is a problem accessing (unable to establish webrtc connection (in the correct mode), incorrect opening of the access page, etc.)
  • guest.css – file with styles for the files listed above

We recommend changing the content of files to suit our needs.

 

Guest page – what the guest will see after entering the link from the key

After opening the link generated in the previous step, the guest will have a page displayed (during testing it is best to open the link in a separate browser or in incognito mode):

Before accessing to :

  1. Properties of the future session to control
  2. A place where you can redeem coupons
  3. After clicking the user goes to the waiting queue (in the mode of one user at a time) or gets access to the points and credits defined in (1)
  4. Logging out (used coupons are forfeited)
  5. Website area (welcome.html file displayed)

The above page mainly allows the use of coupons and through the welcome.html file instructs the visitor what he will be able to do in the next step

After get the access

After clicking the (3) button in the previous step (and when the guest turn arrives (in one user mode at a time)), the guest will be able to control our devices:

  1. The page contains one button with the label “Some Button”,
  2. Remaining time
  3. Other loans.

In the page thus generated, we can lower the credit each time the button is pressed (the credit is reduced after calling the appropriate function on the target device).

ESP programming

For the guest to be able to control our ESP, of course, you need a program loaded into ESP. We do it just like for ordinary ESP control. The most convenient way of using the “wizard” to generate the code, the only thing you need to change while generating the code is to select the option that the program is to support “Guest support”

This will change the generated code:

when changing the variable, we will additionally get parameters with the current time, credit for the other guest, session ID that we can use to lower (increase the credit), and key ID – which can be useful, e.g. when for a given key we do not want to reduce the credit or time. Similarly, the features for handling guest messages have similar parameters more is described in the code documentation for the guest mode

Programming Python Devices

just like for ESP devices, it’s best to use a code generator and, like for ESP, generate code with a rental support function.

identically as for ESP the function will have additional parameters as the remaining time key session ID, it will be possible to reduce the time and credit from a python device for a specific user session code documentation for the guest mode

Generating coupons

Let’s say we want to increase the time and credits for a given guest, this can be done by generating a key with appropriate values – then everyone who uses the link will have set time and credits at the start. The second option is to generate coupons which we can then give / sell to users. Then guest by entering them on the start page they will increase their time limit – credit

a window will appear

  1. Time top-up value (in seconds)
  2. Credit top-up value
  3. Queue priority (when one guest can use the site at a time)
  4. Credit expiry date (not more than half a year)
  5. Only one use – if the user uses the coupon, no one else can re-use the code
  6. How many coupons to generate

A window will appear where one coupon is on one line:

Coupons generated in this way should be saved – you will not be able to view them again later.

Now when we want to increase the time and / or credit for a given guest we send him one of the generated coupons