PiFace 2 - Sensor/Counter not working

Moderators: fantom, leecollings

MrFrankie
Posts: 10
Joined: Tuesday 16 July 2013 8:45
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2585
Contact:

PiFace 2 - Sensor/Counter not working

Post by MrFrankie »

Hi

I hope someone can help me with the following problem. I have a Raspberry Pi 2 Model B with an PiFace 2.
The Pi 2 works fine,fast and is stable. The PiFace....is the problem. I can't get it configured to work correctly.
In Domoticz device list I can't get any counter visible, only some switches.

I have tested with different settings like:
- Disable the device tree
- Enable SPI automatic loading
- Checked the blacklist
- Checked the devices : ls -l /dev/spidev*
crw-rw---T 1 root spi 153, 0 Jan 1 1970 /dev/spidev0.0
crw-rw---T 1 root spi 153, 1 Jan 1 1970 /dev/spidev0.1
- Reconfigured the piface.conf a few times:

Code: Select all

piface.0.output.0.enabled=true
piface.0.output.0.pin_type=level
piface.0.output.0.count_enabled=true
piface.0.output.0.count_update_interval_sec=10

piface.0.input.0.enabled=false
piface.0.input.0.pin_type=level
piface.0.input.0.count_enabled=true
piface.0.input.0.count_update_interval_sec=10
On my input 0 an counter like a watermeter is installed. It will give a pulse to the piface that i want to use as a counter in Domoticz.
So i see some switches in my Domoticz device list, but no counter. Anyone a good suggestion ?

Thanks,
Leon

Raspberry Pi 2 Model B + PiFace Digital 2
Sudo apt-get update / Sudo apt-get upgrade (up-to-date on 2015-06-24 21:00)
Linux Domoticz 4.0.6-v7+ #798 SMP PREEMPT Tue Jun 23 18:06:01 BST 2015 armv7l GNU/Linux
Domoticz V2.2585 Beta release channel
rhendriks
Posts: 44
Joined: Monday 23 December 2013 23:36
Target OS: Raspberry Pi / ODroid
Domoticz version: Newest
Location: Netherlands Helmond
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by rhendriks »

This is the configuration of the watermeter I used

Code: Select all

piface.0.input.0.enabled=true                    //watermeter
piface.0.input.0.pin_type=rising
piface.0.input.0.count_enabled=true
piface.0.input.0.count_update_interval_sec=2
MrFrankie
Posts: 10
Joined: Tuesday 16 July 2013 8:45
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2585
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by MrFrankie »

Thanks,

When I use that configuration I get the option to Add Light/Switch Device. I think that is because of:

Code: Select all

piface.0.input.0.enabled=true
But i need the counter, how can I configure that ?
rhendriks
Posts: 44
Joined: Monday 23 December 2013 23:36
Target OS: Raspberry Pi / ODroid
Domoticz version: Newest
Location: Netherlands Helmond
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by rhendriks »

In the Device menu I have a RFXMeter/counter type but also a Lighting 1 type .
I add the RFXMeter and the Lighting 1 I have not added
MrFrankie
Posts: 10
Joined: Tuesday 16 July 2013 8:45
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2585
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by MrFrankie »

Yeah, that is missing in my device list. Also with new installations.
I think it has to do something with the Hardware/kernel version that is not correct supported.

Raspberry Pi 2 Model B + PiFace Digital 2
Sudo apt-get update / Sudo apt-get upgrade (up-to-date on 2015-06-24 21:00)
Linux Domoticz 4.0.6-v7+ #798 SMP PREEMPT Tue Jun 23 18:06:01 BST 2015 armv7l GNU/Linux
Domoticz V2.2585 Beta release channel
MrFrankie
Posts: 10
Joined: Tuesday 16 July 2013 8:45
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2585
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by MrFrankie »

I created a new installation where I also installed the PiFace-emulator software.
In the emulator the PiFace works well.

In Domoticz I see the sensors. But they will only work after I used the PiFace software to send something first.
So after a reboot I had to send this command from the terminal before my counter works in Domoticz:

Code: Select all

python3 /usr/share/doc/python3-pifacedigitalio/examples/blink.py 
It's getting weird.
jadijkstra2000
Posts: 58
Joined: Monday 26 May 2014 10:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by jadijkstra2000 »

Jeeez, indeed...that works!
So okay should be a fix to get this working :)
MrFrankie
Posts: 10
Joined: Tuesday 16 July 2013 8:45
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2585
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by MrFrankie »

@jadijkstra2000

Do you have the same problem ? Difficult for me to see which issues are related or the same.
If I'm not the only one then it's more likely that it isn't supported in the software.

I use one firmware for the emulator (works correct) and with that same firmware Domotics fails.
What I did for now was removing the loop from the Python script. I have to run it only once at startup. I have to find out which moment is the best.

PiFace-Init (switch port 0 from PiFace)

Code: Select all

from time import sleep
import pifacedigitalio
pifacedigital = pifacedigitalio.PiFaceDigital()
pifacedigital.leds[0].toggle()
jadijkstra2000
Posts: 58
Joined: Monday 26 May 2014 10:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by jadijkstra2000 »

Well, I have the same problem that data is not collected from the sensors on the PiFace, after doing what you described makes it working again...I have The Pi1B & PiFace with latest kernel and latest domoticz build. After starting the script it worked for about a few hours, suddenly the domoticz.sh restarted and again it does not work anymore, after doing a restart of the blink.py it works again...So I think I need to make a watchdog which starts this upon restart domoticz.sh
Dlanor
Posts: 67
Joined: Sunday 22 March 2015 16:18
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by Dlanor »

I have the same problem with my piface. I only get switches and no counters. I have used the following code in piface.conf:

Code: Select all

piface.0.input.1.enabled=true
piface.0.input.1.pin_type=falling
piface.0.input.1.count_enabled=true
piface.0.input.1.count_update_interval_sec=10
Devices displays:

Code: Select all

[Turn On] 	20	PiFace	I	1	Unknown	Lighting 1	Impuls	Off	12	-	[Add Light/Switch Device] [Rename Device]   [Log] 	2015-07-12 17:51:21
[Turn On] 	12	PiFace	O	1	Unknown	Lighting 1	Impuls	Off	12	-	[Add Light/Switch Device] [Rename Device]   [Log] 	2015-07-12 17:51:20
Log file:

Code: Select all

2015-07-12 14:13:55.366 PiFace: Starting PiFace_SPI_Start()
2015-07-12 14:13:55.367 PiFace: SPI device opened successfully
2015-07-12 14:13:55.368 PiFace: Found the following PiFaces:
2015-07-12 14:13:55.368 PiFace: 0

2015-07-12 14:13:55.385 PiFace: config file: Valid address: 0 , Pin: 0 and Port I Parameter: enabled , Value true
2015-07-12 14:13:55.385 PiFace: config file: Valid address: 0 , Pin: 0 and Port I Parameter: pin_type , Value falling
2015-07-12 14:13:55.385 PiFace: config file: Valid address: 0 , Pin: 0 and Port I Parameter: count_enabled , Value 1
2015-07-12 14:13:55.386 PiFace: config file: Valid address: 0 , Pin: 0 and Port I Parameter: count_update_interval_sec , Value 10
What am I doing wrong?
Domoticz| Zigbee | SONOFF
Dlanor
Posts: 67
Joined: Sunday 22 March 2015 16:18
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by Dlanor »

I have tried again with clean Domoticz installation and new piface configuration.
Piface.Conf:

Code: Select all

piface.0.input.0.enabled=false  
piface.0.input.0.pin_type=rising
piface.0.input.0.count_enabled=true 
piface.0.input.0.count_update_interval_sec=10
Domoticz log:

Code: Select all

2015-07-22 19:55:05.879 PiFace: config file: Valid address: 0 , Pin: 0 and Port I Parameter: enabled , Value false
2015-07-22 19:55:05.879 PiFace: config file: Valid address: 0 , Pin: 0 and Port I Parameter: pin_type , Value rising
2015-07-22 19:55:05.879 PiFace: config file: Valid address: 0 , Pin: 0 and Port I Parameter: count_enabled , Value true
2015-07-22 19:55:05.879 PiFace: config file: Valid address: 0 , Pin: 0 and Port I Parameter: count_update_interval_sec , Value 10
Input 0 is still not recognised as RFX counter:

Code: Select all

  Motherboard	I	0	Unknown	Lighting 1	Impuls	Off	12	-	Add Light/Switch 2015-07-22 19:41:44
I have also copied the settings from piface wiki and still same outcome.
Domoticz| Zigbee | SONOFF
MrFrankie
Posts: 10
Joined: Tuesday 16 July 2013 8:45
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2585
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by MrFrankie »

@Dlanor

Don't think it's not your software configuration. I think it's more a hardware configuration that is not supported right now.
I didn't have it correct working in Domoticz. But i have a work around by resetting the piface from a phyton script.
After that it works correct in Domoticz.

First my hardware and software versions:
  • Raspberry Pi 2 Model B + PiFace Digital 2
    Sudo apt-get update / Sudo apt-get upgrade (up-to-date on 2015-06-24 21:00)
    Linux Domoticz 4.0.8-v7+ #805 SMP PREEMPT Thu Jul 16 18:46:20 BST 2015 armv7l GNU/Linux
    Domoticz V2.2585 Beta release channel
A part of my installation procedure:

Code: Select all

1.	Downloaden rom ( http://sourceforge.net/projects/domoticz/files/ ) and put the ISO on a SD card with Win32 disk imager
2.	Insert SD and Reboot
3.	Username: pi  Password: raspberry
4.	Give the raspberry a fixed ip address in your router (DHCP)
5.	sudo passwd root
6.	sudo apt-get update
7.	sudo apt-get upgrade
8.	sudo rpi-update
9.	sudo apt-get install raspi-config
10.	sudo raspi-config
11.	Expand Filesystem 
12.	Adjust the Hostnaam: Domoticz
13.	Adjust the Timezone: Europe-Amsterdam
14.	SPI
To view the list of advanced configuration options, select Option 8 Advanced Options.
Choose the A5 SPI option. Set this to "Yes"
Select "Ok" then "Finish"
15.	Reboot
16.	Username: pi  Password: raspberry
17.	sudo apt-get install lxde-core xserver-xorg xinit
18.	sudo apt-get install lxde-core xserver-xorg xinit --install-suggests 
19.	sudo reboot
20.	Username: pi  Password: raspberry
21.	sudo apt-get install python3-pifacedigital-emulator
22.	sudo reboot
23.	Username: pi  Password: raspberry
24.	python3 /usr/share/doc/python3-pifacedigitalio/examples/blink.py 
Afbreken met CTRL+C
25.	sudo startx
GUI interface only on rpi with a HDMI monitor connected.
Start: pifacedigital-emulator
Test your PiFace
26.	Reboot
27.	Username: pi  Password: raspberry
28.	Browser: Open domoticz url
29.	Setup Settings
30.	Theme : simple-gray
31.	Website protection: Username / Password
32.	Register location
33.	Apply settings
34.	Setup Hardware
35.	Add Piface device
36.	Terminal : cd domoticz
37.	Sudo chmod 666 piface.conf
38.	Vi piface.conf
a.	First disable all devices in the piface
:%s/enabled=true/enabled=false
b.	Set: Input 4 counter.enabled=true  
39.	Add hardware in domoticz
a.	P1 Smart meter
b.	Pi 0 Piface
c.	Weather undergound api
40.	In the devices screen a counter from the PiFace is visible.
Python script to send something to the PiFace

Code: Select all

from time import sleep
import pifacedigitalio
pifacedigital = pifacedigitalio.PiFaceDigital()
pifacedigital.leds[0].toggle()
Sh command to start script above

Code: Select all

python3 /home/pi/domoticz/scripts/python/reset-piface.py
After each reboot I have to start the Sh command above to init the PiFace.
After that it works.

I'm open for improvements and/or suggestions.
nigels0
Posts: 221
Joined: Thursday 23 January 2014 12:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by nigels0 »

Well I've re-installed everything with V2.2657 beta and although the piface seems to be working:

2015-07-31 20:45:36.898 PiFace: Starting PiFace_SPI_Start()
2015-07-31 20:45:36.899 PiFace: SPI device opened successfully
2015-07-31 20:45:36.900 PiFace: Found the following PiFaces:

2015-07-31 20:45:36.900 PiFace: 0

2015-07-31 20:45:36.902 PiFace: config file: Valid address: 0 , Pin: 3 and Port I Parameter: enabled , Value false
2015-07-31 20:45:36.902 PiFace: config file: Valid address: 0 , Pin: 3 and Port I Parameter: pin_type , Value rising
2015-07-31 20:45:36.903 PiFace: config file: Valid address: 0 , Pin: 3 and Port I Parameter: count_enabled , Value true
2015-07-31 20:45:36.903 PiFace: config file: Valid address: 0 , Pin: 3 and Port I Parameter: count_update_interval_sec , Value 5
2015-07-31 20:45:36.979 PiFace: Worker started...

I can't get a new device in the devices list... even after running the reset-piface.py script.
Dlanor
Posts: 67
Joined: Sunday 22 March 2015 16:18
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by Dlanor »

nigels0 wrote:I can't get a new device in the devices list... even after running the reset-piface.py script.
Several topics are active about the same subject. It seems to be a problem with raspi kernel. Try the following:
BigDog wrote:I have reinstall domoticz with the image and did a full update upgrade and downgrade to the kernel 3.10.25+ with the code:

Code: Select all

 sudo rpi-update 2ef601a50b68eebeeb4dc3c6c525855961891be6
It worked for me!
Domoticz| Zigbee | SONOFF
nigels0
Posts: 221
Joined: Thursday 23 January 2014 12:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by nigels0 »

Yes, thanks - tried that before. Piface is working - just not giving me any devices.
nigels0
Posts: 221
Joined: Thursday 23 January 2014 12:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by nigels0 »

Now just completely re-installed from scratch the latest beta, re-installed the kernel to 3.10.25+, enabled the SPI - rebooted. Can communicate with the piface, but Domoticz is still not giving me any devices.
nigels0
Posts: 221
Joined: Thursday 23 January 2014 12:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by nigels0 »

Now re-installed with an earlier version of Domoticz - 2.2657 and now is working...
User avatar
bizziebis
Posts: 182
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by bizziebis »

What I noticed on my Raspberry PI B+ with piface and a recent Domoticz version is that the counter will only show up when it detects a change on the input (a count). Before the update the counter would log every 10 seconds. Even if there was no change in the counter.
macieiks
Posts: 36
Joined: Tuesday 07 July 2015 12:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by macieiks »

Hi, I have got Rasp 2 with PiFace 2 running on Linux raspberrypi 4.0.9-v7+ kernel and V2.2563 version (base image from Domoticz wiki). I have S0 meter with circuit from Domoticz Wiki. I modified my piface.conf with:

Code: Select all

piface.0.input.0.enabled=true
piface.0.input.0.pin_type=falling
piface.0.input.0.count_enabled=true
piface.0.input.0.count_update_interval_sec=10
I can see without any additional init scripts (which u mentioned before) RFXMeter counter with Lighting 1 together. The problem is when I enable this RFXMeter counter the counter does not update in Domoticz - always 0.000 kWh. I tested with voltage meter that on input pin when there is no impulse the voltage is around ~0.5V, when impulse come I can see quick voltage drop - so the circuit is working. Any findings :D ?
RPI2 + RFLink + PiFace D2 + Aeon Z-Wave Gen5 + Foscams FI9821P&R2 + MySensors + UPS APC Back-UPS 950VA
RPI2 + RFXtrx433e + Foscams FI9821P + MySensors + UPS APC Back-UPS 950VA
RPIB+ + TP-Link MR3420 + Huawei E173 GarageDomoticz :)
nigels0
Posts: 221
Joined: Thursday 23 January 2014 12:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: PiFace 2 - Sensor/Counter not working

Post by nigels0 »

@bizziebiz,

Yes, that's exactly what I get now too. Wonder if it is a feature?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests