How to add xS40 to Neuron L203 using custom software
-
Does the file /dev/extcomm/0/0 exist? Try changing it to /dev/ttyNS0 if it does not.
If the TX light on the Neuron doesn't turn on it means there is no communication at all.
I'm not quite clear on what you by having an EVOK service installed.
-
root@raspberrypi:/home/pi# ls /dev/extcomm/
0 1
root@raspberrypi:/home/pi# ls /dev/extcomm/0/0
/dev/extcomm/0/0
root@raspberrypi:/home/pi#seems to exists.
With evok service, I mean the latest EVOK software from Github.
Is it correct to have the RS-485-A connected to the RS-485-A of the xS40 and the
B
's too?Can you point me to the page in the documentation someone should follow when adding an Extension unit?
-
@Boy-Lenssen
It should be connected A-A, B-B, yes, the other way around will not work. The documentation, such as it is, is available from https://evok-6.api-docs.io/1.05/cgct7pncnqf9fper7/introduction, but it's targeted at users with prior experience with serial lines.I would use the following settings myself:
[EXTENSION_1] global_id = 2 ; Mandatory, REQUIRED TO BE UNIQUE device_name = xS40 ; Mandatory modbus_uart_port = /dev/extcomm/0/0 ; Mandatory neuron_uart_circuit = 1_01 ; Optional, allows associating extensions with specific Neuron UART-over-Modbus ports (not possible for non-Modbus UART ports, e.g. /dev/ttyUSB0 or /dev/ttyS0) ;allow_register_access = True ; Optional, False default, is mandatory with third-party devices address = 1 ; Optional, 15 default scan_frequency = 10 ; Optional, 1 default ;scan_enabled = True ; Optional, True default ; Note that the following settings will be inherited by other devices sharing the same port, i.e. /dev/extcomm/0/0 baud_rate = 19200 ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN parity = N ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN stop_bits = 1
Then connect the line and set the dip switches to the following positions:
(apologies for the rotation)
I have verified that these settings work with a fresh EVOK install, with the device in the photo. -
@TomasKnot Hey, thanks a lot! I got it working now. I think I might have forgotten to remove the semi-colon before [EXTENSION 1] :face_palm:
Now the Rx light on the xS40 is now constant on, the run light is still going on / off every 2 seconds. On the neuron, the TX flashes on very swiftly.
I don't see the extra in/outputs when I go to my ip address. How can I read / write the ports now? I thought I would get some ports like 4_05 or so...
I tried something like this: http://192.168.1.16/rest/relay/UART_1_2 but gives a 500 error
-
@Boy-Lenssen
This looks like an address problem perhaps, or possibly some other communication setting issue. Did you try to set it up as I have above? At least for testing purposes.If you did do so then it may be another issue, possibly with a hardware definition; if you can run the following commands while connected to the Neuron and paste the output here we may find the problem.
sudo su systemctl stop evok python /opt/evok.py
-
@TomasKnot
Hi! As far as I can see, I set it up exactly the way you said above...
This is the output:The
/get/all
call is my software requesting the status of all in and outputs, you can ignore that.root@raspberrypi:/home/pi# python /opt/evok/evok.py [I 180522 06:56:19 config:63] eprom: UniPi Neuron L203 version: 1.0 serial: 0x51 [I 180522 06:56:19 evok:1634] Starting using config file /etc/evok.conf [I 180522 06:56:20 config:75] YAML Definition loaded: L30x.yaml, type: 3, definition count 0 [I 180522 06:56:20 config:75] YAML Definition loaded: M20x.yaml, type: 3, definition count 1 [I 180522 06:56:20 config:75] YAML Definition loaded: M50x.yaml, type: 3, definition count 2 [I 180522 06:56:20 config:75] YAML Definition loaded: xS40.yaml, type: 3, definition count 3 [I 180522 06:56:20 config:75] YAML Definition loaded: M30x.yaml, type: 3, definition count 4 [I 180522 06:56:20 config:75] YAML Definition loaded: L40x.yaml, type: 3, definition count 5 [I 180522 06:56:20 config:75] YAML Definition loaded: S10x.yaml, type: 3, definition count 6 [I 180522 06:56:21 config:75] YAML Definition loaded: L51x.yaml, type: 3, definition count 7 [I 180522 06:56:21 config:75] YAML Definition loaded: CUSTOM MODBUS DEVICE.yaml, type: 3, definition count 8 [I 180522 06:56:21 config:75] YAML Definition loaded: L50x.yaml, type: 3, definition count 9 [I 180522 06:56:21 config:75] YAML Definition loaded: xS30.yaml, type: 3, definition count 10 [I 180522 06:56:21 config:75] YAML Definition loaded: xS10.yaml, type: 3, definition count 11 [I 180522 06:56:21 config:75] YAML Definition loaded: M40x.yaml, type: 3, definition count 12 [I 180522 06:56:21 config:75] YAML Definition loaded: M10x.yaml, type: 3, definition count 13 [I 180522 06:56:21 config:75] YAML Definition loaded: M60x.yaml, type: 3, definition count 14 [I 180522 06:56:22 config:75] YAML Definition loaded: L20x.yaml, type: 3, definition count 15 [I 180522 06:56:22 config:75] YAML Definition loaded: xS50.yaml, type: 3, definition count 16 [I 180522 06:56:22 config:75] YAML Definition loaded: evok-alias.yaml, type: 2, definition count 0 [I 180522 06:56:22 evok:1698] HTTP server listening on port: 8080 [I 180522 06:56:22 modbusclient_tornado:122] SPI client started [I 180522 06:56:22 modbusclient_rs485:333] UART client started [I 180522 06:56:22 neuron:268] Reading the UART board on Modbus address 1 [D 180522 06:56:22 owclient:377] Entering 1wire loop [I 180522 06:56:22 web:2064] 101 GET /ws (::1) 3.76ms [D 180522 06:56:22 evok:158] New WebSocket client connected [I 180522 06:56:22 neuron:157] Reading SPI boards [I 180522 06:56:22 web:2064] 200 GET /rest/all (::1) 3.10ms [I 180522 06:56:22 config:351] Alias loaded: <neuron.Relay object at 0x75f42690> al_lights_kitchen [I 180522 06:56:22 config:351] Alias loaded: <neuron.Relay object at 0x75f42650> al_lights_bedroom [I 180522 06:56:24 web:2064] 101 GET /ws (::1) 1.79ms [D 180522 06:56:24 evok:158] New WebSocket client connected [I 180522 06:56:24 web:2064] 200 GET /rest/all (::1) 7.07ms [E 180522 06:56:28 neuron:290] No cached value of register 1018 on unit 1 - read error Traceback (most recent call last): File "/opt/evok/neuron.py", line 283, in readboards yield board.parse_definition(self.hw_dict, 1) File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1055, in run value = future.result() File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 238, in result raise_exc_info(self._exc_info) File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1069, in run yielded = self.gen.send(value) File "/opt/evok/neuron.py", line 409, in parse_definition regpolarity=m_feature['polar_reg'], legacy_mode=self.legacy_mode) File "/opt/evok/neuron.py", line 1309, in __init__ curr_ds = self.arm.neuron.modbus_cache_map.get_register(1, self.regmode, unit=self.arm.modbus_address)[0] File "/opt/evok/neuron.py", line 48, in get_register raise Exception('No cached value of register %d on unit %d - read error' % (counter, unit)) Exception: No cached value of register 1018 on unit 1 - read error ^C[I 180522 06:56:39 evok:1773] Shutting down
-
It looks like the system can't connect to the device - does the RX light on the Neuron (not the extension) flash at all? It should be roughly simultaneous with the TX light.
From the log it looks like there's no valid communication with the extension unfortunately, so something must be wrong with the connection.
-
Hi
this day after a reboot i have the same error message and the link from S103G to xs50 not working only one short blink from the modbus rx/txreinstall evok and fresh image not working.
root@pimatic:~# /usr/bin/python /opt/evok/evok.py [I 180524 19:27:48 config:63] eprom: UniPi Neuron S103 version: 1.0 serial: 0xd [I 180524 19:27:48 evok:1634] Starting using config file /etc/evok.conf [I 180524 19:27:48 config:75] YAML Definition loaded: M20x.yaml, type: 3, definition count 0 [I 180524 19:27:48 config:75] YAML Definition loaded: xS40.yaml, type: 3, definition count 1 [I 180524 19:27:48 config:75] YAML Definition loaded: M30x.yaml, type: 3, definition count 2 [I 180524 19:27:48 config:75] YAML Definition loaded: L40x.yaml, type: 3, definition count 3 [I 180524 19:27:49 config:75] YAML Definition loaded: L50x.yaml, type: 3, definition count 4 [I 180524 19:27:49 config:75] YAML Definition loaded: M50x.yaml, type: 3, definition count 5 [I 180524 19:27:49 config:75] YAML Definition loaded: M40x.yaml, type: 3, definition count 6 [I 180524 19:27:49 config:75] YAML Definition loaded: L30x.yaml, type: 3, definition count 7 [I 180524 19:27:49 config:75] YAML Definition loaded: xS50.yaml, type: 3, definition count 8 [I 180524 19:27:49 config:75] YAML Definition loaded: CUSTOM MODBUS DEVICE.yaml, type: 3, definition count 9 [I 180524 19:27:50 config:75] YAML Definition loaded: M60x.yaml, type: 3, definition count 10 [I 180524 19:27:50 config:75] YAML Definition loaded: L20x.yaml, type: 3, definition count 11 [I 180524 19:27:50 config:75] YAML Definition loaded: S10x.yaml, type: 3, definition count 12 [I 180524 19:27:50 config:75] YAML Definition loaded: xS30.yaml, type: 3, definition count 13 [I 180524 19:27:50 config:75] YAML Definition loaded: M10x.yaml, type: 3, definition count 14 [I 180524 19:27:51 config:75] YAML Definition loaded: L51x.yaml, type: 3, definition count 15 [I 180524 19:27:51 config:75] YAML Definition loaded: xS10.yaml, type: 3, definition count 16 [I 180524 19:27:51 config:75] YAML Definition loaded: DALI.yaml, type: 3, definition count 17 [I 180524 19:27:51 config:75] YAML Definition loaded: evok-alias.yaml, type: 2, definition count 0 [I 180524 19:27:51 evok:1698] HTTP server listening on port: 8080 [I 180524 19:27:51 modbusclient_tornado:122] SPI client started [I 180524 19:27:51 modbusclient_rs485:333] UART client started [I 180524 19:27:51 neuron:268] Reading the UART board on Modbus address 15 [I 180524 19:27:51 neuron:157] Reading SPI boards [D 180524 19:27:51 owclient:377] Entering 1wire loop [I 180524 19:27:51 neuron:172] No board on SPI 2 [E 180524 19:27:51 neuron:290] 'NoneType' object has no attribute 'get_register' Traceback (most recent call last): File "/opt/evok/neuron.py", line 283, in readboards yield board.parse_definition(self.hw_dict, 1) File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1055, in run value = future.result() File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 238, in result raise_exc_info(self._exc_info) File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1069, in run yielded = self.gen.send(value) File "/opt/evok/neuron.py", line 561, in parse_definition self.parse_feature(m_feature, board_id) File "/opt/evok/neuron.py", line 546, in parse_feature self.parse_feature_ao(max_count, m_feature, board_id) File "/opt/evok/neuron.py", line 478, in parse_feature_ao dev_id=self.dev_id, major_group=m_feature['major_group'], legacy_mode=self.legacy_mode) File "/opt/evok/neuron.py", line 1777, in __init__ self.offset = (uint16_to_int(self.arm.neuron.modbus_cache_map.get_register(1, self.regcal + 1, unit=self.arm.modbus_address)[0]) / 10000.0) AttributeError: 'NoneType' object has no attribute 'get_register' [I 180524 19:27:51 neuron:172] No board on SPI 3 [I 180524 19:27:51 config:351] Alias loaded: <neuron.Relay object at 0x7600dc70> al_lights_kitchen [I 180524 19:27:51 config:351] Alias loaded: <neuron.Relay object at 0x7600df50> al_lights_bedroom
Regards
-
I have this exact same issue as "unix", both with the master branch and 2.0.6. Anyone that came up with a solution?
-
Hi @alydersen!
Do you also have the xS50 and S103G models? The error is simply a generic error indicating that no data from the device is available to EVOK in its cache.It can be caused by wrong parity, bitcount or address settings, as well as potentially any other issues which break the communication.By far the most crucial LED indicator is the RX LED light on the master Neuron unit - does it light at all? If not it means that no response has been sent on the bus, which means that there is no data received on the underlying hardware - much less EVOK itself.Please see below, apologies
-
It looks like there has been a recent bug in EVOK which caused the hardware definitions to be parsed incorrectly. What I said above does stand, but the error is a software bug on our part.
You will need to download the release 2.0.7 in order to fix the problems you are seeing. The source of the error is a missing condition which causes UART hw_definitions to break, though only some of the time.
-
Thanks @TomasKnot - will try it out
-
@TomasKnot That did it - thanks again
-
@tomasknot Sorry for the late response! I had a different project that needed my attention.
The RX light of the extension is constant on.
the TX light of the Neuron flashes. The RX light doesn't do anything.Hope we can figure this out, as I got told we need to get this working soon, hopefully this week...
This is the config:
global_id = 1 ; Mandatory, REQUIRED TO BE UNIQUE allow_register_access = False ; Optional, False default scan_frequency = 10 ; Optional, 10 default scan_enabled = True ; Optional, True default ; Below you can find examples for connecting devices over UART; first example is a Neuron extension while the second is a custom third-party device ; Devices sharing a port use the port settings of the first device on that port (baud rate, parity, stopbits) ; !!!Note that device_name has to match a filename in the /etc/hw_definitions directory!!! See /etc/hw_definitions/DOMAT MMIO.yaml for an example [EXTENSION_1] global_id = 2 ; Mandatory, REQUIRED TO BE UNIQUE device_name = xS40 ; Mandatory modbus_uart_port = /dev/extcomm/0/0 ; Mandatory ;neuron_uart_circuit = 1_01 ; Optional, allows associating extensions with specific Neuron UART-over-Modbus ports (not possible for non-Modbus UART ports, e.g. /dev/ttyUSB0 or /dev/ttyS0) ;allow_register_access = True ; Optional, False default, is mandatory with third-party devices address = 1 ; Optional, 1 default ;scan_frequency = 10 ; Optional, 10 default ;scan_enabled = True ; Optional, True default ; Note that the following settings will be inherited by other devices sharing the same port, i.e. /dev/extcomm/0/0 baud_rate = 19200 ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN parity = N ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN stop_bits = 1 ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN
This is the config on the xS40:
What can I do to help troubleshoot further?
-
@Boy-Lenssen
That definitely looks like a problem with UART settings, as no RX on the Neuron indicates that there is no response from the extension, not even an error response (which is what occurs when e.g. reading wrong registers or issuing invalid commands).Could you try using the latest version of EVOK? It is possible that some recent changes will help fix the problems you are seeing.
-
@tomasknot I'm sorry, I'm already running 2.0.7. Forgot to mention.
still getting this:
Traceback (most recent call last): File "/opt/evok/neuron.py", line 289, in readboards yield board.parse_definition(self.hw_dict, 1) File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1055, in run value = future.result() File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 238, in result raise_exc_info(self._exc_info) File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1069, in run yielded = self.gen.send(value) File "/opt/evok/neuron.py", line 571, in parse_definition self.parse_feature(m_feature, board_id) File "/opt/evok/neuron.py", line 547, in parse_feature self.parse_feature_di(max_count, m_feature, board_id) File "/opt/evok/neuron.py", line 413, in parse_feature_di regpolarity=m_feature['polar_reg'], legacy_mode=self.legacy_mode) File "/opt/evok/neuron.py", line 1394, in __init__ curr_ds = self.arm.neuron.modbus_cache_map.get_register(1, self.regmode, unit=self.arm.modbus_address)[0] File "/opt/evok/neuron.py", line 50, in get_register raise Exception('No cached value of register %d on unit %d - read error' % (counter, unit)) Exception: No cached value of register 1018 on unit 1 - read error
-
@TomasKnot do you have any pointers for me? I really need to get this working for a customer :\
Any way I can supply you with more info to test it?
Maybe you can create an SD card image file of the configuration that works for you so I can try it out?
-
@boy-lenssen Hello, I am terribly sorry for a delay on our side. Tommorow morning I will reproduce your setup (L203 with xS40) and supply you with the working image. Thank you for you patience.
Martin
-
Hello @Boy-Lenssen ,
I was able to get a working connection from UniPi Neuron L503 to xS40.Here you can see general wiring, the white wires are for RS485.
Here you can see the DIP switches on the xS40. As you can see, the Modbus address is set to 5, speed to 19200 and no parity. The unit is also set as a last one on the RS485 bus
And here you can see the working setup. I setted some ROs on the xS40 via the web interface
This is the configuration file I used:
#!!! Do not use '#' for comments !!! [MAIN] config_version = 2.5 ; Configuration file version, DO NOT CHANGE! use_schema_verification = False ; Enabling this will deny any requests that do not match the JSON Schema; NOTE THAT THIS RESULTS IN A SIGNIFICANT INCREASE IN LATENCY AND SHOULD NOT BE USED EXCEPT FOR TESTING log_level = ERROR ; Minimum severity of messages to be logged; one of INFO, DEBUG, WARNING, ERROR, CRITICAL log_file = /var/log/evok.log ; Log file to use; will be cleared on boot port = 8080 ; !!! Internal API port - only change if you are certain you know what you are doing; FOR OUR WEB INTERFACE THE PORT SHOULD BE CHANGED IN "/etc/evok-nginx.conf" INSTEAD !!! webhook_enabled = False ; Enables webhook notification - see e.g. https://sendgrid.com/blog/whats-webhook/ webhook_address = http://127.0.0.1:80 ; Put your server endpoint address here (e.g. http://123.123.123.123:/wh ) webhook_device_mask = ["input","wd"] ; List of device types to notify on (written as a JSON list) - adding AI will generate a large amount of messages! webhook_complex_events = False ; EVOK will send POST requests with the same data as WebSocket, rather than an empty GET request wifi_control_enabled = False ; !!! REQUIRES THE UNIPIAP WIFI CONTROLLER TO BE INSTALLED !!! Will allow evok to control the internal Neuron wifi soap_server_enabled = False ; Enables the simple SOAP server; use only if you need the functionality soap_server_port = 8081 ; !!! IF SOAP SERVER IS ENABLED, THIS PORT NEEDS TO BE UNIQUE (i.e. different from the port setting above) !!! [NEURON_1] global_id = 1 ; Mandatory, REQUIRED TO BE UNIQUE allow_register_access = False ; Optional, False default scan_frequency = 10 ; Optional, 10 default scan_enabled = True ; Optional, True default ; Below you can find examples for connecting devices over UART; first example is a Neuron extension while the second is a custom third-party device ; Devices sharing a port use the port settings of the first device on that port (baud rate, parity, stopbits) ; !!!Note that device_name has to match a filename in the /etc/hw_definitions directory!!! See /etc/hw_definitions/DOMAT MMIO.yaml for an example [EXTENSION_1] global_id = 2 ; Mandatory, REQUIRED TO BE UNIQUE device_name = xS40 ; Mandatory modbus_uart_port = /dev/extcomm/0/0 ; Mandatory ;neuron_uart_circuit = 1_01 ; Optional, allows associating extensions with specific Neuron UART-over-Modbus ports (not possible for non-Modbus UART ports, e.g. /dev/ttyUSB0 or /dev/ttyS0) ;allow_register_access = True ; Optional, False default, is mandatory with third-party devices address = 5 ; Optional, 1 default ;scan_frequency = 10 ; Optional, 10 default ;scan_enabled = True ; Optional, True default ; Note that the following settings will be inherited by other devices sharing the same port, i.e. /dev/extcomm/0/0 baud_rate = 19200 ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN parity = N ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN stop_bits = 1 ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN ;[EXTENSION_2] ;global_id = 3 ; Mandatory, REQUIRED TO BE UNIQUE ;device_name = CUSTOM MODBUS DEVICE ; Mandatory ;modbus_uart_port = /dev/extcomm/0/0 ; Mandatory ;neuron_uart_circuit = 1_01 ; Optional, allows associating extensions with specific Neuron UART-over-Modbus ports (not possible for non-Modbus UART ports, e.g. /dev/ttyUSB0 or /dev/ttyS0) ;allow_register_access = True ; Mandatory with third-party devices ;address = 1 ; Optional, 15 default ;scan_frequency = 2 ; Optional, 1 default ;scan_enabled = True ; Optional, True default [OWBUS_1] owbus = /dev/i2c-1 --i2c=/dev/i2c-1:ALL ; Scanned bus (--i2c=/dev/i2c-1:ALL or localhost:2122 or 'u' for USB dongle) interval = 3 ; [s] Default sensor reading scan_interval = 300 ; [s] How often is scanning done ;Example of 1W-4R/4DI extension module, 1W-8R is almost the same, only with inputs instead of relays ; ; - Map a new 1Wire sensor with the appropriate address, type and interval ; - The syntax can be either SENSOR or 1WDEVICE ; - Setting the correct reading interval is crucial to achieve ideal performance; the default interval is 15s ; ;[1WDEVICE_2] ;bus = 1 ;address = 29F39A17000000BC ;type = DS2408 ;interval = 1 ; ;[1WRELAY_10] ;sensor = 2 ;pin = 0 ; ;[1WRELAY_11] ;sensor = 2 ;pin = 1 ; ;[1WRELAY_12] ;sensor = 2 ;pin = 2 ; ;[1WRELAY_13] ;sensor = 2 ;pin = 3 ; ;[1WINPUT_20] ;sensor = 2 ;pin = 4 ; ;[1WINPUT_21] ;sensor = 2 ;pin = 5 ; ;[1WINPUT_22] ;sensor = 2 ;pin = 6 ; ;[1WINPUT_23] ;sensor = 2 ;pin = 7
I can supply you with working image as well, but I used an up-to-date Raspbian Stretch Lite and installed the Evok according to documentation with default values . Please test the settings above and let me know, if it works for you
Martin
-
still the Rx on the Extension light is on and I get the same error as I posted before when running
sudo python /opt/evok/evok.py
@martin-kudláček said in How to add xS40 to Neuron L203 using custom software:
The unit is also set as a last one on the RS485 bus
do I need to do something for this? I'm sorry, I'm quite a noob on this.