Announcement

Collapse

Contacting HomeSeer This Week

HomeSeer is open and operational this week. All orders are being processed and shipped as usual. However, some staff are working from home. If you need to contact HomeSeer for support or customer service, please use our Email or Chat options. https://homeseer.com/contact-us/
See more
See less

I would like to modify a /HomeSeer/settings.ini line from a .sh script (Linux)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I would like to modify a /HomeSeer/settings.ini line from a .sh script (Linux)

    Hi,

    I would like to make the order of plugin startup the same at each startup.

    First, I thought about just deleting the file '' rm /HomeSeer/settings.ini '' and then
    Code:
     wait 15;  cp settingsStatic.ini  /HomeSeer/settings.ini
    from a .sh script. I would have called this from the same event I use when hs is turned off.

    So the file would always be the same at each startup.

    But i looked at the content of the file and i am not sure all settings can be ''static'' ex: LastDevRef=1747 and gLastShutdownOK=True.


    IS there a cmd I could use to only edit the io_interfaces line from a sh script, so it would always look like this ?

    io_interfaces=EasyTrigger:,Big5:,Z-Wave:,AirplaySpeak:,Pushover 3P:,MeiHarmonyHub:,UltraLog3:,LutronCaseta:,APCUPSD:,Squeeze Box:,AK Google Calendar:,Device History:,Twilio Messaging:


    Thanks


  • #2
    Code:
    #!/bin/bash
    # edit HS3 settings.ini to substitute a fixed io_interfaces line
    
    io_interfaces="EasyTrigger:,Big5:,Z-Wave:,AirplaySpeak:,Pushover 3P:,MeiHarmonyHub:,UltraLog3:,LutronCaseta:,APCUPSD:,Squeeze Box:,AK Google Calendar:,Device History:,Twilio Messaging:"
    
    hs3root=/HomeSeer
    
    settings=$hs3root/Config/settings.ini
    
    # backup original first time only
    test ! -f $settings.orig && cp -a $settings{,.orig}
    
    # backup everytime
    cp -a $settings{,.bak}
    
    # change io_interfaces key to defined value
    tmpfile=/tmp/$(basename $settings)
    awk -F= ' BEGIN { OFS = FS }
    {
        if ($1 == "io_interfaces") $2 = io_interfaces
        print
    }
    ' io_interfaces="$io_interfaces" $settings > $tmpfile && mv -f $tmpfile $settings
    set 'hs3root' envar per your system.

    Run without sudo first then verify file at /tmp/settings.ini looks as expected. (this step will throw some 'Permission denied' errors)

    When satisfied, run with sudo.

    Comment


    • #3
      zwolfpack Thanks a lot.

      I’m gonna try this tomorrow and report .

      Comment


      • #4
        Works perfect ! zwolfpack

        I think copy-pasting, or me, made a typo here . There was a space between Squeeze and Box.

        io_interfaces=EasyTrigger:,Big5:,Z-Wave:,AirplaySpeak:,Pushover 3P:,MeiHarmonyHub:,UltraLog3:,LutronCaseta:,APCUPSD:,SqueezeBox:,AK Google Calendar:,Device History:,Twilio Messaging:

        Comment

        Working...
        X