Making a finite state machine (FSM), or switch/case

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
vegardb123
Posts: 5
Joined: 24 Feb 2017 17:18

Making a finite state machine (FSM), or switch/case

Post by vegardb123 » 08 Mar 2017 15:32

Hi!

Me and a couple of friends have made a script for two Fibaro motion sensors and a FIbaro door/window sensor. The script checks if someone exits the house (the house/building), and calls a Python script which sends a message to a PC server. When the person comes back, the Python script is called again and the server recieves a message that says the person has come home.

The problem is that the main javascript has way to many if/else statements, and it's hard to keep track of them all. We would like to make a state machine, but we only have experience in making state machines in C#. Does anyone have any experience in making state machines in javascript? Or maybe a switch/case structure could work?

Post Reply