[RELEASE] OmniThing v0.8.2 - ESP8266/ESP32/RaspberryPi/Linux/Windows Web-based Configuration Tool

I have managed to get OmniThing working on a raspberry pi using a virtual ethernet interface.

Create a new file called /etc/network/interfaces.d/omnithing

In that file, paste the text below with a few modifications:

auto eth_omni
iface eth_omni inet static
  address 192.168.1.54/24
  hwaddress ether ba:4d:09:46:57:98
  pre-up ip link add eth_omni link eth0 type macvlan
  post-down ip link del eth_omni link eth0 type macvlan
  up ip netns add omnithing && ip link set eth_omni netns omnithing && ip netns exec omnithing ip addr add 192.168.1.54/24 dev eth_omni && ip netns exec omnithing ip link set eth_omni up
  down ip netns del omnithing

Replace ā€œba:4d:09:46:57:98ā€ with whatever made up mac address you want for the virtual interface.

Replace both instances of ā€œ192.168.1.54/24ā€ with whatever static IP you want to assign to the virtual interface (this should be a valid ip on your LANā€™s subnet which isnā€™t already in use; NOTE: this should NOT be the same as the piā€™s eth0 ip).

Now, edit the OmniThing script found at /opt/omnithing/omnithing.sh
Replace this line:

./OmniThing config.json >> logs/omnithing.log 2>&1

With this:

ip netns exec omnithing ./OmniThing config.json >> logs/omnithing.log 2>&1

Now, run this command to ensure new versions of the omnithing package will not overwrite your edited omnithing.sh:

sudo dpkg-divert --divert /opt/omnithing/omnithing.sh.new /opt/omnithing/omnithing.sh

If you already had OmniThing installed on your pi, be sure to update it before rebooting. I just released a fix for a nasty bug associated with the CommandExecuter:

sudo apt-get update && sudo apt-get upgrade

Now feel free to reboot, and OmniThing should use the virtual interface for now on.

When configuring OmniThing in the SmartThings app, be sure to use the ip and mac you set in the interfaces file above, not your piā€™s eth0 ip and mac.

If you ever want to see information about your virtual interface, run:

sudo ip netns exec omnithing ip addr
3 Likes

I will give that a shot. Thank you,!!!

1 Like

Great, thanks! Iā€™ll try this and report back. I use pm2, so will use that to start it and monitor the state.

1 Like

So, after I do this, would I also access the web configuration with the new IP address or the old IP address?

Youā€™d use the old IP. The nodejs server is still running on the eth0 interface.

Edit: though if you wanted to you could make it run using the new IP by similarly editing itā€™s startup script.

Okayā€¦Iā€™m not sure what Iā€™m doing wrong. It created a child device but it doesnā€™t seem to be actually changing the state of my GPIO pin. Hereā€™s the JSON config. Any idea what Iā€™m doing wrong?

{
    "NetworkReceiver": {
        "type": "NetworkReceiverHttpLib",
        "port": 8090
    },
    "NetworkSender": {
        "type": "NetworkSenderHttpLib",
        "ip": "192.168.1.24",
        "port": 39500
    },
    "CompositePeriphs": [],
    "Devices": [
        {
            "triggers": [
                {
                    "interval": 0,
                    "offset": 0,
                    "command": "poll"
                }
            ],
            "subscriptions": [
                {
                    "source": "Switch",
                    "event": "changed",
                    "command": "poll"
                }
            ],
            "type": "Switch",
            "name": "Switch",
            "output": {
                "type": "DigitalOutputPinRaspberryPi",
                "initial": false,
                "invert": false,
                "pin": 16
            },
            "invert": false,
            "initial": false,
            "input": {},
            "ignoreRedundant": false
        }
    ]
}

I would change the poll interval for the switch to at least 5000 ms. As it is, itā€™s likely trying to constantly send packets to the hub.

After that if things arenā€™t working, run ā€œtail -F /opt/omnithing/logs/omnithing.logā€ to watch the log. Try turning the switch on and off in the smartthings app, and verify that the log outputs that itā€™s receiving json messages from ST.

Since the ST child device has been created, that verifies that Omnithing to hub communications are working. Itā€™s possible that something is up with SmartThings to Omnithing communications.

So, I tried deleting the parent device and recreating it, thinking that was the problem. I also made the changes to the config like your recommended for the polling interval. Now, I get two devices in ST and neither of them does anything other than ā€œturning onā€.

So, I deleted the parent again and then created a new one. And I still only get Turning On or Turning Off.

Is that the only change you would recommend for the JSON config? I am totally just guessing at all of it so any recommendation you would have would be appreciated.

I think the json is fine. Have you tried looking at the Omnithing log? Thatā€™s the best way to figure out if itā€™s receiving the commands from ST.

1 Like

It does not appear to be. hereā€™s the updated JSON file"

{
    "NetworkReceiver": {
        "type": "NetworkReceiverHttpLib",
        "port": 8090
    },
    "NetworkSender": {
        "type": "NetworkSenderHttpLib",
        "ip": "192.168.1.24",
        "port": 39500
    },
    "CompositePeriphs": [],
    "Devices": [
        {
            "triggers": [
                {
                    "interval": 500,
                    "offset": 0,
                    "command": "poll"
                }
            ],
            "subscriptions": [
                {
                    "source": "Switch",
                    "event": "changed",
                    "command": "poll"
                }
            ],
            "type": "Switch",
            "name": "Switch",
            "output": {
                "type": "DigitalOutputPinRaspberryPi",
                "initial": false,
                "invert": false,
                "pin": 16
            },
            "invert": false,
            "initial": false,
            "input": {},
            "ignoreRedundant": false
        }
    ]
}

and hereā€™s what I see in the omnithing log:

Sending json: {"updates": [{"name": "Switch", "type": "Switch", "switch": "off"}]}
Return value: 202
Poll triggered for Switch Switch
{"name": "Switch", "type": "Switch", "switch": "off"}

Sending json: {"updates": [{"name": "Switch", "type": "Switch", "switch": "off"}]}
Return value: 202
Poll triggered for Switch Switch
{"name": "Switch", "type": "Switch", "switch": "off"}

Sending json: {"updates": [{"name": "Switch", "type": "Switch", "switch": "off"}]}
Return value: 202
Poll triggered for Switch Switch
{"name": "Switch", "type": "Switch", "switch": "off"}

This is what iā€™m seeing in LiveLoggingā€¦it also appears to be inundating my hub with status messages.

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:24 PM: debug sending event: name=switch value=off

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:24 PM: debug parsing [name:Switch, switch:off, type:Switch]

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:23 PM: debug sending event: name=switch value=off

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:23 PM: debug parsing [name:Switch, switch:off, type:Switch]

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:21 PM: debug sending event: name=switch value=off

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:21 PM: debug parsing [name:Switch, switch:off, type:Switch]

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:21 PM: debug sending event: name=switch value=off

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:21 PM: debug parsing [name:Switch, switch:off, type:Switch]

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:18 PM: debug sending event: name=switch value=off

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:18 PM: debug parsing [name:Switch, switch:off, type:Switch]

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:17 PM: debug sending event: name=switch value=off

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:17 PM: debug parsing [name:Switch, switch:off, type:Switch]

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:14 PM: debug sending event: name=switch value=off

[648d053d-9938-43db-a505-a46fc7d990b6](https://graph.api.smartthings.com/ide/logs#648d053d-9938-43db-a505-a46fc7d990b6) 5:40:14 PM: debug parsing [name:Switch, switch:off, type:Switch]

Live logging for the parent device:

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:36 PM: debug child with name=Switch exists already.

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:36 PM: debug Searching for child device with network id: BA4D09465798_Switch

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:36 PM: debug parsing updates array

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:36 PM: debug [updates:[[name:Switch, switch:off, type:Switch]]]

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:36 PM: debug received body:
{"updates": [{"name": "Switch", "type": "Switch", "switch": "off"}]}

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:34 PM: debug child with name=Switch exists already.

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:34 PM: debug Searching for child device with network id: BA4D09465798_Switch

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:34 PM: debug parsing updates array

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:34 PM: debug [updates:[[name:Switch, switch:off, type:Switch]]]

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:34 PM: debug received body:
{"updates": [{"name": "Switch", "type": "Switch", "switch": "off"}]}

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:32 PM: debug child with name=Switch exists already.

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:32 PM: debug Searching for child device with network id: BA4D09465798_Switch

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:32 PM: debug parsing updates array

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:32 PM: debug [updates:[[name:Switch, switch:off, type:Switch]]]

[153da20b-99b2-48c9-a1c3-e35531022e69](https://graph.api.smartthings.com/ide/logs#153da20b-99b2-48c9-a1c3-e35531022e69) 5:41:32 PM: debug received body:
{"updates": [{"name": "Switch", "type": "Switch", "switch": "off"}]}

Youā€™re missing a zero on that poll interval. It should be 5000, not 500 (hence the constant message spamming to the hub every half second).

Just to double check, go back into the omnithing parent settings in the SmartThings app, and make sure you specified 8090 as the port and whatever IP you put in that interfaces file for the IP.

Also can you show me the output of sudo ip netns exec omnithing ip addr ?

When you toggle the switch on/off, do you get log output in the parent device handler similar to this?

ebcad37e-a380-43fd-9702-9c7d921da979  5:55:08 PM: debug Using ip: 192.168.1.54 and port: 8090 for 
device: ebcad37e-a380-43fd-9702-9c7d921da979
ebcad37e-a380-43fd-9702-9c7d921da979  5:55:08 PM: debug Executing 'sendEthernet' 
{"name":"executerTest","cmd":"push"}

ARGH!!! I was wondering why you had me setting it for only 500 ms. Never occurred to me to double check i was reading it write. DUH! Thank you so much. Iā€™ll give it another shot later tonight.

Okayā€¦hereā€™s something even weirder. I just checked my routerā€™s IP address table and the virtual network device, the one I assigned IP address .111 to, has an IP address of .54! And that MAC doesnā€™t appear anywhere in my reserved addresses table. I just checked /etc/network/interfaces.d/omnithing and it is set to .111. So, where is it getting the 54 from?!? So odd.

I switched it to 54 in ST and it worked!!! So, hey, not gonna argue. Itā€™s working.

1 Like

Oh yeah thatā€™s because itā€™s the static address being set in that interfaces file. The virtual interface isnā€™t set up to use DHCP as itā€™s currently configured. Iā€™m glad you got it working!

Yeah, but i had mine set to .111 in the interfaces file. So, why would it use .54? And nope, definitely not working. Getting too frustrated to keep working on it today. Maybe some other day.

Itā€™s actually in 2 places in the interfaces file. Iā€™d make sure you changed it in both, since my example has it as 54.

The value toward the top gets overwritten by the value below. It has to reset the IP after the network namespace is created.

I didnā€™t even see the second one. Thanks!

Is there a way to troubleshoot duplicate Mac address mqtt-bridge and cast-web device network id?

I am assigning the IP that I set for omnithing on the router to the virtual interface setting. I am not sure how to use this.
mqtt-bridge and cast-web are installed on the docker.

See post #20 in this thread.

This is how he did it for Omni thing. Youā€™re on your own if you want to do it for other sources.

Thank you for answer.
Iā€™ve tried applying it to the content. I have pinged the IP address of the omni virtual interface in raspberry psh ssh. I have not been assigned to a router, but I can not.

I do not know what to do ā€¦!

What? If you assign the virtual network device only those packages you assign to it will use it. Unless you tell SSH to use the second (virtual) adapter, what you are doing wonā€™t work. Did you read through the whole post? Do you know how TCPIP works?
You might just want to buy a second RPi. That would probably be easier.