Panstamp Integration

Begonnen von youngengineer, 17 September 2014, 07:37:09

Vorheriges Thema - Nächstes Thema

justme1968

about the double ;;

this is one of the reasons you should not not directly edit the them config file but use the web fronted to enter you defines via the DEF and attr text fields.

in the config file you have to do the escaping of ; and newlines by ourself. if you use the web fronted fhem will take care of this (most of the time).

you would for example enterdefine motionSensor notify SWAP_52:0D.* {}into the command box on top of the page or via telnet and then go to the device detail view and klick on DEF and then enterset myLight3 dim 100;; define pirTimer2 at +00:00:20 set myLight3 dim 30without escaping into the text field.

you can activate an editor with syntax highlighting following this steps: http://www.fhemwiki.de/wiki/Konfiguration#Syntaxhervorhebung
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

youngengineer

I've never used the command prompt at the top of the screen, and always edited the config file directly, I like having control over the structure of the config file and grouping of my modules to keep everything neat.

The link you provided is awesome and the syntax highlighting very useful.

I have had an idea for my PIR being active only at certain times of the day. What if I modified my panStamp sketch to include another binary out endpoint, I could then power on that endpoint to HIGH(3.3v) turning on a 3.3v PIR using the at timer module? Or would that be a bad idea?



justme1968

you should just forget that there is something like the config file. in the same way that you do not make the windows registry or a database neat. it really makes things easier if the config file is just that. a config file.

you can use the comment attribute of every device to make small comments and  if the code of the notify gets bigger move it to 99_myUtils.pm and add comments as much as you like.


switching the pir off during the day in a hardware level is certainly an option. you can also just set the disabled attribute of the notify.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

youngengineer

Ah yes so I could use attr motionSensor disabledForIntervals 05:00-23:00 to disable the notify on the software side, very nice indeed. I think for some reason however I might go with a hardware powerdown as I actually quite like the idea, that way I could also have a manual on/off command too if I bind it to readingsProxy as it would be a separate endpoint. Though I will have to experiment with the PIR, I have a feeling that when it is powered on for the first time that It might push a HIGH out of the output pin as it stabilizes, but again I will have to test.

I'm really starting to enjoy FHEM, its extremely flexible but the learning curve is a little high, some of the translations also make it harder to understand, though I might be able to help at some point to rewrite some of the commandref once I understand it better, although I must say as a German your English is excellent and your support even better. I hope to learn more about perl in the future to get more creative with the modules as there are some things I wish to do which are to complex to even request help for.

















justme1968

feel free to ask whenever there is a need to...
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

youngengineer

#35
Andre, I must request your expertise once again.

I am still wandering about the functionality which we discussed previously, which is now very important to me. I almost have the GUI just as I would like it but I really would like to have a user friendly way to change key parameters without having to go through the command line or go through DEF.

For example say I have my dimming timer, SWAP_52:0D.* set myLight3 dim 100; define pirTimer2 at +00:00:20 set myLight3 dim 30

In the same way that it is possible using webcmd  on:off:dim,0,10,100 shortcuts etc which will display some form of graphical control on the GUI itself, surly it would be possible to do so with other modules.

For example say I have my dimming timer, SWAP_52:0D.* set myLight3 ($DIMVALUE); define pirTimer2 at ($TIMEVALUE) set myLight3 ($DIM2VALUE)

How difficult would it be to the the same principles to push these values to the GUI in the same way that other modules do? So for example have a simple timer:textbox value displayed for the timer or a simple dim:,0,10,20,30 etc dropdown box to select the dim value directly from the GUI for that module?

I understand this is not so easy as it will most likely require custom modification to the myutils module, but I am just wondering if you might be able to give me an example!

If not please let me pay your help in doing so!

Thanks again!



youngengineer

Andre, I understand my previous request may be a bit much to ask for. I will try to find a private developer to help instead.

A have a slightly simpler question which may not take to much of your time. What would be the easiest way to reverse the dim:slider. Currently moving the slider from the left to the right will decrease LED brightness as the PWM value will increase reducing light output. (LED PSU max output is at 0 and minimum at 255)

0 on the slider should really mean the light is at its minimum value (0xFF) and 100 its maximum (0x00) but it seems to be the other way around, this works fine for powering a LED for example but not in my case due to the PSU design.

I have made the most obvious changes in myutils such as if( $value == 0x00 ) return "on"; etc but the way the slider orders its dim values eludes me.

As you recommended I have also now rectified the issue I was having to completely turn off my LED PSU when the PWM value is equal to or greater then 250 directly in the sketch avoiding having to send a separate command to the Binout endpoint.


Again thanks for your time.

justme1968

just a little bit patience...

to get the slider direction right just change the calculation so that (100-$VALUE) ist used. additional changing in and off to 00 and FF of course.

or you change the sketch to have 0 as off ans FF as on.

for the other questions: the best way would probably bei to introduce additional commanda like level1, level2 and time, store the values as readings in the device and use them with ReadingsVal().
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

youngengineer

Hi Andre.

About the reverse dimmer function, when you are referring to the (100-$VALUE) are you talking about this calculation here?

$value = sprintf( "%02X", $args*2.40+0.5 );

justme1968

yes. something like this:$value = sprintf( "%02X", (100-$args)*2.40+0.5 );
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

youngengineer

That's working well, thank you Andre!

I have a few more questions if you don't mind.

How can I assign devices to the main page, i.e /fhem? Or set the default room/homepage?
When SWAP devices are detected they are added to the SWAP room, how would I hide the SWAP room or have the panStamps added to the hidden room when found?
Is there an easy way to define a specified endpoint for all SWAP devices, for example SWAP_*:0D.* or  SWAP_*:0C


Oh and it seems as though I have a bug. Sometimes some SWAP device endpoints will start to duplicate themselves. No sure why this happens but I will attach a picture. I have checked my sketch and can see anything wrong..


Thanks again for you time.





justme1968

you can not assign anything to the main page currently.

you can use the hiddenroom attribute in the WEB instance where you want to hide things. it should contain a comma separated list of all rooms and interface elements that should be hidden. it is best ti create an additional fhemweb instance with its own port for this.

what exactly do you want to do with this? setting a value can be done with something like set SWAP_.* regSet 0D ...

about the random register values appearing: normaly this happens if there is some rf interference or other cause for bad reception. i should probably add an option to skip registers that are not included in the device xml file.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

youngengineer

Thanks Andre.

I have used SWAP_.* with the notify module so that I can define a single notify attribute for all motes in the network. It seems to be working correctly so far!


youngengineer

As for the duplicate endpoints, I must be in a very noisy environment as it tends to happen quite often.
I would say at least 6-8 of my motes out of my current 12 have duplicate endpoints, I tend to manually delete them whenever they appear however I agree that It would be better to resolve the issue as you have suggested.

justme1968

please try the attaeched version.

if this helps with the wrong endpoints i will make it a configurable option.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968